Do some googling on leading wildcards and read things like http://www.gossamer-threads.com/lists/lucene/java-user/175732 and pick an option you like.
-- Ian. On Mon, Oct 14, 2013 at 9:12 AM, nischal reddy <nischal.srini...@gmail.com> wrote: > Hi, > > I have problem with doing wild card search on file path fields. > > i have a field "filePath" where i store complete path of files. > > i have used StringField to store the field ("i assume by default > StringField will not be tokenized") . > > doc.add(new StringField(FIELD_FILE_PATH,resourcePath, Store.YES)); > > I am using StandardAnalyzer for IndexWriter > > but since i am using a StringField the fields are not analyzed. > > After the files are indexed i checked it with Luke the path seems fine. And > when i do wildcard searches with luke i am getting desired results. > > But when i do the same search in my code with IndexSearcher i am getting > zero docs > > My searching code looks something like this > > indexSearcher.search(new WildcardQuery(new > Term("filePath","*SuperClass.cls")),100); > > this is returning zero documents. > > But when i just use "*" in query it is returning all the documents > > indexSearcher.search(new WildcardQuery(new Term("filePath","*")),100); > > only when i use some queries like prefix wildcard etc it is not working > > What is possibly going wrong. > > Thanks, > Nischal Y --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org