You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Björn Kremer <bk...@patorg.de> on 2011/11/10 15:44:17 UTC

[Lucene.Net] How to detect 'NOT_ANALYZED' fields

Cello,

I'd like to enable other users to do a custom search on my index. I 
offer a little function that allows the user to pass a search string to 
the queryparser.

*Sample: *

  Protected Shared Function GetIndexedFields(ByVal reader As 
Index.IndexReader) As String()
       Dim fields As ICollection(Of String) = 
reader.GetFieldNames(Index.IndexReader.FieldOption.INDEXED)
       Return fields.ToArray()
  End Function
  Dim fields() As String = GetIndexedFields(searcher.GetIndexReader())
  parser = New 
QueryParsers.MultiFieldQueryParser(Lucene.Net.Util.Version.LUCENE_29, 
fields, StandardAnalyzerObject)

Unfortunally some of my fields are indexed as 'NOT_ANALYZED' so the user 
can't search them directly with the queryparser. I'd like to change the 
'StandardAnalyzerObject' to a PerFieldAnalyzerWrapper to solve the 
problem. Therefor I need to know what fields are indexed as 
'NOT_ANALYZED'. Is there a fast and performant way to detect the 
'NOT_ANALYZED' fields while processing the search request?

Sincere regards,
Björn