0
votes

I am using the standardanalyzer and adding the field I want to search by with the following code

                doc.Add(
                    new Field(
                        "BookId",
                        book.CatalogueBookNo.ToString(),
                        Field.Store.YES,
                        Field.Index.NOT_ANALYZED,
                        Field.TermVector.NO));

                doc.Add(
                    new Field("Title",
                        strTitle, 
                        Field.Store.YES, 
                        Field.Index.ANALYZED, 
                        Field.TermVector.NO));

                doc.Add(
                    new Field("Author",
                        strAuthor,
                        Field.Store.YES,
                        Field.Index.ANALYZED,
                        Field.TermVector.NO));

                doc.Add(
                    new Field("IssueId_fk", 
                        book.IssueId_fk, 
                        Field.Store.YES, 
                        Field.Index.NOT_ANALYZED, 
                        Field.TermVector.NO));

All fields are searchable except the IssueId_Fk field (which is not analyzed and is therefore intact) - this field contains string values in the format '11_12_4', '11_12_3' etc.

I have opened the the lucene index in notepad and can confirm that the values are delimited and complete with underscores but searching on the IssueId_Fk field returns nothing.

Anyone know how to get around this?

Cheers

Wing

2

2 Answers

0
votes

so can you try analyzing with solr.KeywordTokenizerFactory ?

0
votes

Actually have now solved this by creating a customanalyzer. However thanks for the info about solr tokenizers. Howver not quite clear about the need for the keyword tokenizer - if you want a field to remain intact (say for example ID fields etc) and not be changed in any way you just don't analyse it. This should have worked but with standardanalyser somehow it didn't. –