From: <br...@us...> - 2007-01-11 21:01:16
|
Revision: 5179 http://svn.sourceforge.net/exist/?rev=5179&view=rev Author: brihaye Date: 2007-01-11 13:00:56 -0800 (Thu, 11 Jan 2007) Log Message: ----------- Changed storeText() signature Modified Paths: -------------- trunk/eXist/src/org/exist/storage/ContentLoadingObserver.java trunk/eXist/src/org/exist/storage/NativeBroker.java trunk/eXist/src/org/exist/storage/NativeElementIndex.java trunk/eXist/src/org/exist/storage/NativeTextEngine.java trunk/eXist/src/org/exist/storage/NativeValueIndex.java trunk/eXist/src/org/exist/storage/TextSearchEngine.java Modified: trunk/eXist/src/org/exist/storage/ContentLoadingObserver.java =================================================================== --- trunk/eXist/src/org/exist/storage/ContentLoadingObserver.java 2007-01-11 17:19:19 UTC (rev 5178) +++ trunk/eXist/src/org/exist/storage/ContentLoadingObserver.java 2007-01-11 21:00:56 UTC (rev 5179) @@ -45,7 +45,7 @@ public void storeAttribute( AttrImpl node, NodePath currentPath, boolean fullTextIndexSwitch ); /** store and index given text node */ - public void storeText( TextImpl node, NodePath currentPath, boolean fullTextIndexSwitch ); + public void storeText(TextImpl node, NodePath currentPath, int indexingHint); /** corresponds to SAX function of the same name */ public void startElement(ElementImpl impl, NodePath currentPath, boolean index); Modified: trunk/eXist/src/org/exist/storage/NativeBroker.java =================================================================== --- trunk/eXist/src/org/exist/storage/NativeBroker.java 2007-01-11 17:19:19 UTC (rev 5178) +++ trunk/eXist/src/org/exist/storage/NativeBroker.java 2007-01-11 21:00:56 UTC (rev 5179) @@ -311,10 +311,10 @@ } } - private void notifyStoreText(TextImpl text, NodePath currentPath, boolean fullTextIndex ) { + private void notifyStoreText(TextImpl text, NodePath currentPath, int indexingHint) { for (int i = 0; i < contentLoadingObservers.size(); i++) { ContentLoadingObserver observer = (ContentLoadingObserver) contentLoadingObservers.get(i); - observer.storeText(text, currentPath, fullTextIndex); + observer.storeText(text, currentPath, indexingHint); } } @@ -2434,8 +2434,7 @@ // check if this textual content should be fulltext-indexed // by calling IndexPaths.match(path) if (ftIdx == null || ftIdx.match(currentPath)){ - boolean valore = (ftIdx == null ? false : ftIdx.preserveContent(currentPath)); - textEngine.storeText(ftIdx, (TextImpl) node, valore); + textEngine.storeText(ftIdx, (TextImpl) node, ftIdx == null ? TextSearchEngine.TOKENIZE : TextSearchEngine.DO_NOT_TOKENIZE); } break; } @@ -2999,20 +2998,21 @@ // by calling IndexPaths.match(path) if (fullTextIndex && !isTemp) { boolean indexText; - boolean preventTokenization; + int tokenize; if (ftIdx == null || currentPath == null) { indexText = true; - preventTokenization = false; + tokenize = TextSearchEngine.TOKENIZE; } else { indexText = ftIdx.match(currentPath); - preventTokenization = ftIdx.preserveContent(currentPath); + tokenize = ftIdx.preserveContent(currentPath) ? + TextSearchEngine.DO_NOT_TOKENIZE : TextSearchEngine.TOKENIZE; } if (indexText) - textEngine.storeText(ftIdx, (TextImpl) node, preventTokenization); + textEngine.storeText(ftIdx, (TextImpl) node, tokenize); } - notifyStoreText( (TextImpl)node, currentPath, fullTextIndex ); - // storeText( TextImpl node, NodePath currentPath, boolean fullTextIndexSwitch ); + notifyStoreText( (TextImpl)node, currentPath, + fullTextIndex ? TextSearchEngine.DO_NOT_TOKENIZE : TextSearchEngine.TOKENIZE); break; } } Modified: trunk/eXist/src/org/exist/storage/NativeElementIndex.java =================================================================== --- trunk/eXist/src/org/exist/storage/NativeElementIndex.java 2007-01-11 17:19:19 UTC (rev 5178) +++ trunk/eXist/src/org/exist/storage/NativeElementIndex.java 2007-01-11 21:00:56 UTC (rev 5179) @@ -160,7 +160,7 @@ // TODO Auto-generated method stub } - public void storeText(TextImpl node, NodePath currentPath, boolean fullTextIndexSwitch) { + public void storeText(TextImpl node, NodePath currentPath, int indexingHint) { // TODO Auto-generated method stub } Modified: trunk/eXist/src/org/exist/storage/NativeTextEngine.java =================================================================== --- trunk/eXist/src/org/exist/storage/NativeTextEngine.java 2007-01-11 17:19:19 UTC (rev 5178) +++ trunk/eXist/src/org/exist/storage/NativeTextEngine.java 2007-01-11 21:00:56 UTC (rev 5179) @@ -97,7 +97,7 @@ public static final double DEFAULT_WORD_CACHE_GROWTH = 1.4; public static final double DEFAULT_WORD_KEY_THRESHOLD = 0.01; public static final double DEFAULT_WORD_VALUE_THRESHOLD = 0.015; - + public final static byte TEXT_SECTION = 0; public final static byte ATTRIBUTE_SECTION = 1; public final static byte QNAME_SECTION = 2; @@ -251,16 +251,16 @@ * if <code>false</code>, it is tokenized before being indexed */ //TODO : use an indexSpec member in order to get rid of <code>noTokenizing</code> - public void storeText(FulltextIndexSpec indexSpec, TextImpl text, boolean noTokenizing) { + public void storeText(FulltextIndexSpec indexSpec, TextImpl text, int indexingHint) { final DocumentImpl doc = (DocumentImpl)text.getOwnerDocument(); //TODO : case conversion should be handled by the tokenizer -pb final XMLString t = text.getXMLString().transformToLower(); TextToken token; - if (noTokenizing) { + if (indexingHint == DO_NOT_TOKENIZE) { token = new TextToken(TextToken.ALPHA, t, 0, t.length()); invertedIndex.setDocument(doc); invertedIndex.addText(token, text.getNodeId()); - } else { + } else if (indexingHint == TOKENIZE){ tokenizer.setText(t); while (null != (token = tokenizer.nextToken())) { if (token.length() > MAX_TOKEN_LENGTH) { @@ -309,7 +309,7 @@ } } - public void storeText(TextImpl node, NodePath currentPath, boolean fullTextIndexSwitch) { + public void storeText(TextImpl node, NodePath currentPath, int indexingHint) { // TODO Auto-generated method stub } Modified: trunk/eXist/src/org/exist/storage/NativeValueIndex.java =================================================================== --- trunk/eXist/src/org/exist/storage/NativeValueIndex.java 2007-01-11 17:19:19 UTC (rev 5178) +++ trunk/eXist/src/org/exist/storage/NativeValueIndex.java 2007-01-11 21:00:56 UTC (rev 5179) @@ -233,7 +233,7 @@ // TODO Auto-generated method stub } - public void storeText(TextImpl node, NodePath currentPath, boolean fullTextIndexSwitch) { + public void storeText(TextImpl node, NodePath currentPath, int indexingHint) { // TODO Auto-generated method stub } Modified: trunk/eXist/src/org/exist/storage/TextSearchEngine.java =================================================================== --- trunk/eXist/src/org/exist/storage/TextSearchEngine.java 2007-01-11 17:19:19 UTC (rev 5178) +++ trunk/eXist/src/org/exist/storage/TextSearchEngine.java 2007-01-11 21:00:56 UTC (rev 5179) @@ -60,7 +60,10 @@ protected final static Logger LOG = Logger.getLogger(TextSearchEngine.class); - protected TreeSet stoplist = new TreeSet(); + public static int TOKENIZE = 0; + public static int DO_NOT_TOKENIZE = 1; + + protected TreeSet stoplist = new TreeSet(); protected DBBroker broker = null; protected Tokenizer tokenizer; protected Configuration config; @@ -157,7 +160,7 @@ * @param idx * @param text */ - public abstract void storeText(FulltextIndexSpec idx, TextImpl text, boolean onetoken); + public abstract void storeText(FulltextIndexSpec idx, TextImpl text, int indexingHint); public abstract void storeText(FulltextIndexSpec indexSpec, StoredNode parent, boolean idxAsQName, String text); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |