Hi Ian, Actually im able to do wildcard searches on all the fields except the "filePath" field. I am able to do both the leading and trailing wildcard searches on all the fields, but when i do the wildcard search on filepath field it is somehow not working, an eg file path would look some thing like this "\Samples\F1.cls" i think because of "\" present in the field it is failing. when i do a wildcard search with the query "filePath : *" it is indeed returning all the docs in the index. But when i do any other wildcard searches(leading or trailing) it is not working, any clues why it is working in other fields and not working on "filePath" field.
TIA, Nischal Y On Mon, Oct 14, 2013 at 4:55 PM, Ian Lea <ian....@gmail.com> wrote: > 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 > >