Question

Dim terms As New WildcardTermEnum(index_reader, New Term("filename", "*" + search_box.Text + "*"))

    While terms.[Next]()
                Dim currentTerm As Term = terms.Term()
                Dim value As [String] = currentTerm.Text()
    End While

i have two fields "filename" and "id"

i can get value of "filename" field by using the above code but i want to get value of id field in while loop..

for example;

filename:"TEST" and id:"10"

using above code i can get "TEST" string but i want to get id value related to filename field..

Thanks for helping

Was it helpful?

Solution

Simply run a search with a single TermQuery using currentTerm. You can get the ids from the results.

Better yet, bypass the WildcardTermEnum and run a wildcard search. Because there is limited support for wildcards at the start of the term, you may want to consider using a SpanWildcardQuery.

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