How can I configure SOLR to use synonyms ONLY on specific fields? I can't find anything in docs and I am using "SynonymGraphFilterFactory" in managed-schema.
thanks
Solr does this by default. Solr uses synonyms only in fields where the definition of the field references the SynonymGraphFilterFactory filter (notice that this can be directly defined on the field/field type or indirectly.)
For example, the default definition of the text_general references the synonyms.txt and so does the text_en but not string or text_ca.
If you have fields where you don't want synonyms to be applied you could create a new field definition similar to text_general and make sure it does not uses the synonyms filter.
For information about the SynonymGraphFilterFactory take a look at the Filters section in the Solr guide. For information about how Analyzers, Tokenizers, and Filters work together take a look at this tutorial.
Related
Regarding the Multi Select Faceting, there is a feature whereby we can have a single filter tagged with multiple tags, like the following example:
fq={!tag=tag1,tag2,tag3}my_field:my_filter
However, I have not been able to figure out the use and advantage of this. Anyone has any information on this? I am using Solr 7.4.0
Edwin
Tagging filters are useful for excluding those filters when faceting. Multi-tagging is useful when certain filters should only apply to specific facets. To expand the example from the manual:
fq={!tag=dt}doctype:pdf&fq={!tag=cat}category:important&facet=true&facet.field={!ex=dt}doctype&facet.field={!ex=cat}category&facet.field={ex=cat,dt}author
In this case you can exclude the doctype filter for the doctype facet, and exclude the category filter for the category facet, while excluding both when faceting on author.
Solr version 6.1.0
Created a schema with some fields as indexed=true on which I specifically want the solr main-query q to search.
And also added more fields, which I just wanted to select, so marked them as stored=true and indexed=false.
Issue now is that, main query q=India is searching on non-indexed fields like country, which I have specified in the image.
See the result below
It is selecting the non-indexed field only when I specify the full value of non-indexed field.
See result for q=Indi
How can I restrict solr from searching on non-index fields?
According to the screenshot above you're copying the content sent to the field country into the field _text_. When you're not giving Solr a specific field to search (i.e. you're not using one of the dismax handlers with qf or not prefixing your term with the field name field:value), it falls back to the default search field. This is set to _text_ by default. This field is indexed, and since you're copying the content from your country field into the _text_ field, the values from country will give a hit.
If you don't want this to happen, don't copy the content from country into _text_, or give Solr the actual field you want to search.
I am working on eCommerce web application which is developed using DOT NET MVC. I use Solr to index product details. So that I have mentioned Product related fields to my Solr Schema file.
Now I also want to index SearchTerm to Solr. For this how can I manage my Schema file to store/index searchterm as my Schema file is product specific?
Can anyone please suggest?
You can have a separate core for this and define the new schema.xml for it or if you want to use the existing schema.xml then you can make use of the dynamic fields by which you need not have bother in future if any other field you need to add..
You can use Dynamic fields.
Dynamic fields allow Solr to index fields that you did not explicitly define in your schema.
This is useful if you discover you have forgotten to define one or more fields. Dynamic fields can make your application less brittle by providing some flexibility in the documents you can add to Solr.
A dynamic field is just like a regular field except it has a name with a wildcard in it. When you are indexing documents, a field that does not match any explicitly defined fields can be matched with a dynamic field.
For example, suppose your schema includes a dynamic field with a name of *_i.
If you attempt to index a document with a cost_i field, but no explicit cost_i field is defined in the schema, then the cost_i field will have the field type and analysis defined for *_i.
Like regular fields, dynamic fields have a name, a field type, and options.
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
I'm new to Solr's faceting. The facet section in the search response sees only contain facet terms and counts, no documents associated. Now, if I would like to find a document which belongs to a facet, do I need to pass the facet in the search query and do the search over again? what is the best way to use facets? Thanks
Yes, you have to issue a new search, typically by adding a filter query, in the form of myfacetfield:"facetterm" to your original request.
If you want the documents belonging to each aggregation bucket delivered up front, you can use grouping instead.
I'm new to Drupal, apachesolr and facetapi. I have a default server defined in my search environment; the Facets configuration doesn't list some of my article fields (the article entity type is configured for indexing). I created a second environment and this lists the same limited facets as the default environment. Any suggestions on how I can get all the article fields listed?
The fields Apache solr includes in its facets configuration page should be only fields that are select-type fields or taxonomy terms, or something similar.
If you have a field that's just a regular 'Text' or 'Integer' or 'Link' field, it won't appear in that facets configuration page, because those type of fields don't work well as facets.
If you want a field you have to be used as a facet, make sure you make its type be something that can be selected from a list. Does that make sense? Was that the problem in your case?