aymens

Untitled

Mar 21st, 2011
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. protected boolean indexProperty(NodeRef banana, QName propertyName, Serializable value, Document doc, boolean indexAtomicPropertiesOnly, Map<QName, Serializable> properties)
  2. {
  3.     String attributeName = "@" + QName.createQName(propertyName.getNamespaceURI(), ISO9075.encode(propertyName.getLocalName()));
  4.  
  5.     boolean store = true;
  6.     boolean compress = true;
  7.     /* ... */
  8.  
  9.     PropertyDefinition propertyDef = getDictionaryService().getProperty(propertyName);
  10.     if (propertyDef != null)
  11.     {
  12.         index = propertyDef.isIndexed();
  13.         store = propertyDef.isStoredInIndex();
  14.         compress = propertyDef.isCompressedWhenStoredInIndex();
  15.         /* ... */
  16.     }
  17.     /* ... */
  18.                 }
  19.                 // add the text field using the stream from the
  20.                 // reader, but only if the reader is valid
  21.                 if (readerReady)
  22.                 {
  23.                     if(store){
  24.                         Field field = null;
  25.                         int max = (int)Runtime.getRuntime().freeMemory() / 100;
  26.                         if(compress){
  27.                             field = new Field(attributeName, reader.getReader().getContentString(max), Field.Store.COMPRESS, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
  28.                         }else{
  29.                             field = new Field(attributeName, reader.getReader().getContentString(max), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
  30.                         }
  31.                         doc.add(field);
  32.                     }else{
  33.                     /*
  34.                       ...
  35.                     */
Advertisement
Add Comment
Please, Sign In to add comment