Question

I have a solr index with indexed text. I'd like to query documents that start with a certain term. I didn't find a way to do that with the lucene or dismax query parser.

Is there a way to do that?

A solution I thought of is to index the strings with a special token at the beginning of each line, i.e: "STARTOFTEXT" and then query for "STARTOFTEXT something". Is there a nicer solution?

Was it helpful?

Solution

What about making a field in the schema that contains the first word? Then when when you build the document you can grab the first word and store it separately from the rest of the text.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top