Foros de discusión
Search in custom fields
Jozef Chocholacek, modificado hace 9 años.
Search in custom fields
New Member Mensajes: 13 Fecha de incorporación: 24/04/14 Mensajes recientes
Hello everybody!
Environment
Liferay: 6.1 (EE)
Solr-web: Solr Search Engine EE 1.0.2
Solr: 1.4
Situation
My customer uses tags to add to users "areas of interest" and "areas of expertise". Because tags are not index by default(?), I wrote my own UserIndexerPostProcessor to add my custom fields to the index.
I also added two new fields into the schema.xml in both Solr and solr-web plugin (because without them weren't my custom fields tokenized):
I've regenerated my search indexes, and when I search for a keyword (e.g. "intranet") direct in Solr
I am getting some (seemingly correct) results. Anyway, when I put the same keyword into Liferay search field, I am not getting the same users as direct from Solr. I get some users, but only if they have the keyword in their position name (or other standard property).
When I capture the request the Liferay sends to Solr and try it direct from browser, I am also getting incorrect results - so the problem lies (IMHO) in the way how Liferay constructs the query. I have added
to my UserIndexerPostProcessor, but it didn't help.
EDIT: when I type in Liferay search field areasOfExpertise:intranet, then I see the correct results, i.e. the same results as with direct Solr query (http://my.solr.server:8980/solr/select?q=areasOfExpertise:intranet&rows=10). But I need these results to come without specifying the field name, too.
Any hints/ideas/RTFM pointers?
Thanks,
Jozef.
Environment
Liferay: 6.1 (EE)
Solr-web: Solr Search Engine EE 1.0.2
Solr: 1.4
Situation
My customer uses tags to add to users "areas of interest" and "areas of expertise". Because tags are not index by default(?), I wrote my own UserIndexerPostProcessor to add my custom fields to the index.
document.addText(AREAS_OF_INTEREST, StringUtil.merge(interestsTags, ", "));
I also added two new fields into the schema.xml in both Solr and solr-web plugin (because without them weren't my custom fields tokenized):
<field name="areasOfExpertise" type="text" indexed="true" stored="true" />
<field name="areasOfInterest" type="text" indexed="true" stored="true" />
I've regenerated my search indexes, and when I search for a keyword (e.g. "intranet") direct in Solr
http://my.solr.server:8980/solr/select?q=areasOfExpertise:intranet&rows=10
I am getting some (seemingly correct) results. Anyway, when I put the same keyword into Liferay search field, I am not getting the same users as direct from Solr. I get some users, but only if they have the keyword in their position name (or other standard property).
When I capture the request the Liferay sends to Solr and try it direct from browser, I am also getting incorrect results - so the problem lies (IMHO) in the way how Liferay constructs the query. I have added
@Override
public void postProcessFullQuery(BooleanQuery fullQuery, SearchContext searchContext) throws Exception {
fullQuery.addTerm(AREAS_OF_EXPERTISE, searchContext.getKeywords());
fullQuery.addTerm(AREAS_OF_INTEREST, searchContext.getKeywords());
}
to my UserIndexerPostProcessor, but it didn't help.
EDIT: when I type in Liferay search field areasOfExpertise:intranet, then I see the correct results, i.e. the same results as with direct Solr query (http://my.solr.server:8980/solr/select?q=areasOfExpertise:intranet&rows=10). But I need these results to come without specifying the field name, too.
Any hints/ideas/RTFM pointers?
Thanks,
Jozef.
Vilmos Papp, modificado hace 9 años.
RE: Search in custom fields
Liferay Master Mensajes: 529 Fecha de incorporación: 21/10/10 Mensajes recientes
Hi Jozef,
I think, probably the assetTagNames field should be checked in your case.
E.g.: You have the following tags: "intranet", "library", "internet"
Then assetTagNames:"intranet" should return the proper resutls imho.
Regards,
Vilmos
I think, probably the assetTagNames field should be checked in your case.
E.g.: You have the following tags: "intranet", "library", "internet"
Then assetTagNames:"intranet" should return the proper resutls imho.
Regards,
Vilmos