SrikanthMedisetti opened a new issue, #12259:
URL: https://github.com/apache/lucene/issues/12259

   ### Description
   
   Hello Team,
   I have the following use case.
   Store/Index data without tokenize (use StringField) and maintain the same 
string while storing (maintain case sensitivity while storing data). The 
problem I face is during search. If I store field called name as 'Lucene' and 
if I try to search with 'lucene', I'm not able to get the store data with 
'Lucene'.
   
   I'm trying to use Lucene 9.5.0 
   
   `public class LuceneExample {
       public static void main(String[] args) throws IOException, 
ParseException {
           // Create index
           KeywordAnalyzer analyzer = new KeywordAnalyzer();
           String indexDirectoryPath = new 
StringBuilder("/temp/").append("test").toString();
           // create the directory to store the index
           Directory directory = 
FSDirectory.open(Paths.get(indexDirectoryPath));
           IndexWriterConfig config = new IndexWriterConfig(analyzer);
           IndexWriter writer = new IndexWriter(directory, config);
   
           Document doc = new Document();
           doc.add(new StringField("name", "John Smith", Field.Store.YES));
           writer.addDocument(doc);
           writer.close();
   
           // Search index
   
           // create a reader to read the index
           IndexReader reader = DirectoryReader.open(directory);
           IndexSearcher searcher = new IndexSearcher(reader);
           QueryParser parser = new QueryParser("name", analyzer);
           Query query = parser.parse("john smith");
           TopDocs results = searcher.search(query, 10);
           for (int i = 0; i < results.scoreDocs.length; i++) {
               Document hitDoc = searcher.doc(results.scoreDocs[i].doc);
               System.out.println(hitDoc.get("name"));
           }
       }
   }`
   
   Am I missing something here? Could you please help me out.
   
   Thanks in advance!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to