Im trying to achieve the following in SOLR via faceting.
I want to return all the MODEL fields where the MAKE field = 'FORD'
http://wa12-d17251.print.tradermedia.co.uk:8080/solr/select/?q=make:FORD&fq={!geofilt}&sfield=location&pt=51.5375,-0.1934&d=5&facet=true&facet.field=model&facet.query=make:FORD&rows=0
Ignore the geoLocation stuff.
What i get back is all of the other MODELS which i understand why as they are not joined in any way.
How would i configure solr to just return Models where the Make is 'X'
Any help appreciated.
Thanks
Ben
I want to return all the MODEL fields where the MAKE field = 'FORD'
I assume you meant "model values" instead of "model fields"
q=*:*&fq=make:FORD&facet=true&facet.field=model
If you're using Solr 4+, you can use pivoted faceting (Group facets by make) then select the elements under 'Ford'.
&facet=true&facet.pivot=MAKE,MODEL
Related
I have a Solr server with data under this format:
{
id: 1,
text_1: "some_text1",
text_2: "some_text2",
},
{
id: 2,
text_1: "some_text1",
text_2: "some_text2",
}
I need to find documents like the ones I wrote above. Documents that have the same "text_1" and "text_2" values but different ids.
I've tried using facets, but I'm not sure if it helps. Firstly, it only returns a count of the duplicates and I need the id's of these documents. Secondly, I'm not sure that faceting over multiple fields does what I want. I'm not sure that:
facet.field=text_1&facet.field=text_2 shows me a count of documents that have both those fields.
Thank you, I don't know much about Solr. Any help is greatly appreciated!
I think facets are your best bet to get this done, but as you noticed you will need to issue at least two queries: one to get the facets and another to fetch the actual documents that belong to the facet (i.e. the duplicates in your case)
To get the multi facets to work for what you are trying to do you'll need to use PivotFaceting (https://lucene.apache.org/solr/guide/7_0/faceting.html#pivot-decision-tree-faceting). The syntax is facet=on&facet.pivot=field1,field2
Make sure the field that you use for facets is a string field and not a text field.
I am using Solr version 3.5. I want to implement an auto-suggest feature in my application through the Suggester approach. http://wiki.apache.org/solr/Suggester.
Can someone please help me with the following:
How can i return more than one fields in the query response. For example, i am trying to create an index based on the 'name' field, but i also want to return an 'id' field where these two fields are the product attributes i am search for [say movie titles]. Hence, the response should include both the 'id' and 'title' of the product
How can i do a case-insensitive search using Suggester? For example, a search term "abc" should return documents containing the name as "ABC", "Abc" etc.
Please help.
Regards.
If you're looking to get suggestions on a particular field but also return other fields in the document, you can use the 'Payload' tag. Only one payload field is allowed, but you can get around this by using a json format in the field.
https://cwiki.apache.org/confluence/display/solr/Suggester
https://stackoverflow.com/a/32558487/578582
I think you're not quite getting the point of the suggester. It is not designed to return suggestions for exactly one search result per entry (this is the only scenario where returning the ID would make sense).
You could, however, do normal wildcard searches on the title field and use the returned titles as suggestions. This way you could also get the ID (and any other index field) with the results. I imagine this could be implemented fairly easily with jQuery UI. It may be much slower than the suggest API, depending on your index schema design.
if you are not really interested in the order of the suggestions i found that the weight_field can be [ab]used to return the document id for each suggestion
Ive got following schema.xml
...
id
book
pages
genre (horror,action)
...
Is solr able to return results like this?
genre;books;pages
horror(genre);12(books);124543(pages)
action(genre);2(books);437(pages)
As you can see i want to facet over more than one field. The only thing i got work is the facet search over genre and books. But i want to have the pages as a sum also in my results.
Is Solr able to do this?
Thanks!
you can check for Solr Pivot Faceting which will provide you with hierarchy facets.
You can check if you get the pages, the summing can be done at Client side.
We use IBM WCS v7, with embeded Apache Solr. Solr is used as a search engine for our e-commerce based application.
As per a recent requirement, we want to use multi select facet functionality, where the user can check multiple facet attributes, and the corresponding values will be OR'ed to the search result.
Ex- I wish to check Color:RED, Color:BLUE and Color:BLACK in my default Search Results, so that each attribute value will be OR'ed in the resulting search results display.
We use the out-of-the-box SearchDisplayCmd, for our Search functionality, where the field "metaData=" takes care of history of the facets applied, and "facet=" takes care of applying a facet field. For the query param "metaData", it encodes the multiple facets into base64 encoding. It uses a special de-limiter to AND the different facet fields,and restrict the search results.
brand:"POLO" color:"RED" shape:"Oval"
I want to know, if there exists any such de-limiter or any alternatives by using which, I can perform an OR operation, on different values of the same facet attribute, and use "metaData" parameter to maintain a history of the applied facets.
Any help on the same front is highly appreciated. Any other approaches, on applying multiple values of the same facet attribute are also welcome.
Great Thanks in advance.
Regards,
Jitendriya Dash
I recently worked on this: Select multiple values of same facet
I was able to get it also.
Try to find where it hits the tag. The expression builder I used comes OOB. getCatalogNavigationView. Make sure you use the appropriate searchProfile.
Pass the facet param in this way.
<c:forEach var="facetSelect" value="paramValues.facet">
<wcf:param name="facet" value="facetSelect>
</c:forEach
But by this method you will not be able to select values from any other attributes. If someone knows how to select values from the same facet or different facet, pls share.
Update SELECTION column of FACET table to 1 to mark the facetable attribute as multi selectable.
In WCS7+, for enabling multi select facet functionality go to FACET table and set 'SELECTION' column value to 1 instead of 0.
If an attribute is to be made multi select facet, you can make the changes from CMC. Go to the attribute dictionary select the attribute and in facetable properties, check 'Allow multiple facet value'.
In Solrj (Solr 3.6), am I able to filter my search for a dynamic field:
params.set("fl", "name*_s");
Or do I still need to copy this field to a new field (non-dynamic) in order to search it?
Thank you in advance.
params.set("fl", "name*_s");
I don't think you can do this in 3.6. At least, the patch is labelled as "Fix Version/s: 4.0"
Now, you can still retrieve a value from a specific dynamic field, like "name123_s" by naming it directly.
But I'm not sure if I'm answering the right question, as "fl" isn't involved in filtering, or searching. "fl" is the list of stored fields to return.
If you want to search multiple fields, you should look at the "qf" parameter of the edismax query parser.