On 4/8/2015 5:06 PM, Ryan Josal wrote: > The error: > IllegalStateException: field "foo" indexed without position data; cannot > run PhraseQuery. > > It would actually be ok for us to index position data but there isn't an > option for that without term frequencies. No TF is important for us when > it comes to searching product titles. > > I should say that only a small fraction of user queries contained quoted > phrases that trigger this error, so it works much of the time, but we'd > also like to continue supporting user quoted phrase queries. > > So how can I index a field without TF and use it in edismax qf?
If you omit positions, you can't do phrase queries. As far as I know, there is no option in Solr to omit only frequencies and not positions. I think there is a way that you can achieve what you want, though. What you are looking for is filters. The fq parameter (filter query) will restrict the result set to only entries that match the query, but will not affect the relevancy score *at all*. Here is an example of a filter query that restricts the results to items that are in stock, assuming you have the appropriate schema: fq=inStock:true Queries specified in fq will default to the lucene query parser, but you can override that if you need to. This query would be equivalent to the previous one, but it would be parsed using edismax: fq={!edismax}inStock:true Here's another example of a useful filter, using yet another query parser: fq={!terms f=userId}bob,alice,susan Remember, the reason I have suggested filters is that they do not influence score. https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters#CommonQueryParameters-Thefq%28FilterQuery%29Parameter Thanks, Shawn