1

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.

anand tiwari
  • 157
  • 2
  • 10
  • Hi all, i resolved the case-sensitive suggest issue by converting everything to lower case. However, still not able to fine out a way of returning multiple fields in the response. Any suggestions will be helpful. – anand tiwari Jul 01 '13 at 06:03
  • anand : bhai were you able to resolve the multiple field issue? I'm facing the same issue. Please could you share your solution. Thanks a lot – nish Nov 27 '13 at 11:43
  • Hi Nish,No, Solr does not support this. – anand tiwari Feb 03 '14 at 08:33
  • Thanks for the update. Any other way of doing it? – nish Feb 03 '14 at 09:01

3 Answers3

2

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

Community
  • 1
  • 1
eamon1234
  • 1,555
  • 3
  • 19
  • 38
  • What do you mean by "you can get around this by using a JSON format"? Could you please help me to understand? – Gibbs Jun 15 '20 at 16:49
1

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.

Konrad Holl
  • 616
  • 5
  • 12
0

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

Nikos Tsagkas
  • 1,287
  • 2
  • 17
  • 31