[
https://issues.apache.org/jira/browse/LUCENE-4891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13616071#comment-13616071
]
Shai Erera commented on LUCENE-4891:
------------------------------------
I cannot reproduce it. I wrote this code:
{code}
Directory indexDir = new RAMDirectory(), taxoDir = new RAMDirectory();
IndexWriter iw = new IndexWriter(indexDir, new
IndexWriterConfig(Version.LUCENE_50, null));
DirectoryTaxonomyWriter tw = new DirectoryTaxonomyWriter(taxoDir);
FacetFields ff = new FacetFields(tw);
Document doc = new Document();
ff.addFields(doc, Arrays.asList(new CategoryPath("type/CHAT", '/'), new
CategoryPath("me"), new CategoryPath("network/hanirc/chan/#sdgsdgsd", '/')));
iw.addDocument(doc);
iw.close();
tw.close();
DirectoryReader ir = DirectoryReader.open(indexDir);
TaxonomyReader tr = new DirectoryTaxonomyReader(taxoDir);
// print the categories encoded for the document
CategoryListIterator cli = new
CategoryListParams().createCategoryListIterator(0);
cli.setNextReader(ir.leaves().get(0));
IntsRef ints = new IntsRef();
cli.getOrdinals(0, ints);
for (int i = 0; i < ints.length; i++) {
System.out.println(ints.ints[i] + "=" + tr.getPath(ints.ints[i]));
}
IndexSearcher searcher = new IndexSearcher(ir);
CountFacetRequest me = new CountFacetRequest(new CategoryPath("me"), 10);
CountFacetRequest network = new CountFacetRequest(new CategoryPath("network",
"hanirc", "chan"), 10);
CountFacetRequest type = new CountFacetRequest(new CategoryPath("type"), 10);
FacetSearchParams fsp = new FacetSearchParams(me, network, type);
FacetsCollector fc = FacetsCollector.create(fsp, ir, tr);
searcher.search(new MatchAllDocsQuery(), fc);
System.out.println(fc.getFacetResults());
ir.close();
tr.close();
{code}
And it prints category ordinals:
{noformat}
2=type/CHAT
3=me
5=network/hanirc
6=network/hanirc/chan
7=network/hanirc/chan/#sdgsdgsd
{noformat}
And result:
{noformat}
[Request: me nRes=10 nLbl=10
Num valid Descendants (up to specified depth): 0
me (1.0), Request: network/hanirc/chan nRes=10 nLbl=10
Num valid Descendants (up to specified depth): 1
network/hanirc/chan (1.0)
network/hanirc/chan/#sdgsdgsd (1.0), Request: type nRes=10
nLbl=10
Num valid Descendants (up to specified depth): 1
type (0.0)
type/CHAT (1.0)]
{noformat}
As you can see, {{#sdgsdgsd}} returns a count of {{1.0}}.
I ran the code with and without the fix applied to LUCENE-4882 and it ran fine.
Can you please review the code snippet and fix it so that it fails? It's best
if you can attach a {{.patch}} file, with a (unit) test that fails.
> Only a part of CategoryPath is recorded if I add "me" category.
> ---------------------------------------------------------------
>
> Key: LUCENE-4891
> URL: https://issues.apache.org/jira/browse/LUCENE-4891
> Project: Lucene - Core
> Issue Type: Bug
> Components: modules/facet
> Affects Versions: 4.2
> Reporter: crocket
>
> If I add [type/CHAT, me, network/hanirc/chan/#sdgsdgsd] as "categories" to a
> document and add the document to a writer as below, Only
> "network/hanirc/chan", not "network/hanirc/chan/#sdgsdgsd "is" recorded into
> a taxonomy directory. type/CHAT and me are recorded well. I confirmed it with
> a test.
> FacetFields ff = new FacetFields(taxoWriter);
> ff.addFields(doc, categories);
> nrtWriter.addDocument(doc);
> If I add [type/CHAT, network/hanirc/chan/#sdgsdgsd] to a document, everything
> is recorded fine.
> What's wrong with "me" category?
> You could clone git://snowberry.me/ZeroIrcLog.git and read the code if you
> want.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]