[ 
https://issues.apache.org/jira/browse/LUCENE-4659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shai Erera updated LUCENE-4659:
-------------------------------

    Attachment: LUCENE-4659.patch

More cleanup. Here's a summary of all the changes:

* CategoryPath is now immutable. As such it does not implement Cloneable and 
clone() is removed.

* CategoryPath.add is removed - used only by tests, and they were converted to 
use alternative methods, e.g. subpath().

* CategoryPath.subpath returns a sub-path of the CategoryPath (used to traverse 
parents)

* CategoryPath exposes two public final 'components' and 'length' members. This 
removed the length() and getComponent() methods (getComponent was only used in 
test). I added jdocs to these two members.

* CategoryPath no longer implements Serializable.

* CategoryPath.\*serialize\* methods moved to CategoryPathUtils under the cl2o 
package, as it's the only one that uses them.

* All 'prefixLen' variants were removed. Instead one should call 
cp.subpath(prefix).
** This allowed removing all prefixLen variants from TaxoWriterCache, and nuke 
3 duplicate methods in DirTaxoWriter.

* Handled a TODO in DirTaxoReader - since now CategoryPath is immutable, it can 
hold caches to-from CategoryPath instead of String.

CategoryPath is now 215 lines, instead of ~1100 !
                
> Cleanup CategoryPath
> --------------------
>
>                 Key: LUCENE-4659
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4659
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>         Attachments: LUCENE-4659.patch, LUCENE-4659.patch
>
>
> CategoryPath is supposed to be a simple object which holds a category path's 
> components, and offers some utility methods that can be used during indexing 
> and search.
> Currently, it exposes lots of methods which aren't used, unless by tests - I 
> want to get rid of them. Also, the internal implementation manages 3 char[] 
> for holding the path components, while I think it would have been simpler if 
> it maintained a String[]. I'd like to explore that option too (the input is 
> anyway String, so why copy char[]?).
> Ultimately, I'd like CategoryPath to be immutable. I was able to get rid most 
> of the mutable methods. The ones that remain will probably go away when I 
> move from char[] to String[]. Immuntability is important because in various 
> places in the code we convert a CategoryPath back and forth to String, with 
> TODOs to stop doing that if CP was immutable.
> Will attach a patch that covers the first step - get rid of unneeded methods 
> and beginning to make it immutable.
> Perhaps this can be done in multiple commits?

--
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]

Reply via email to