Re: Searching in keyword field ?

2004-11-10 Thread Thierry Ferrero
Thanks Justin, it works fine 

- Original Message - 
From: Justin Swanhart [EMAIL PROTECTED]
To: Lucene Users List [EMAIL PROTECTED]
Sent: Tuesday, November 09, 2004 7:41 PM
Subject: Re: Searching in keyword field ?


 You can add the category keyword multiple times to a document.

 Instead of seperating your categories with a delimiter, just add the
 keyword multiple times.

 doc.add(Field.Keyword(category, ABC);
 doc.add(Field.Keyword(category, DEF GHI);

 On Tue, 9 Nov 2004 17:18:19 +0100, Thierry Ferrero (Itldev.info)
 [EMAIL PROTECTED] wrote:
  Hi All,
 
  Can i search only one word in a keyword field which contains few words.
  I know keyword field isn't tokenized. After many tests, i think is
  impossible.
  Someone can confirm me ?
 
  Why don't i use a text field? because the users know the category from a
  list (ex: category ABC, category DEF GHI, category  JKL ...) and the
keyword
  field 'category' can contains severals terms (ABC, DEF GHI, OPQ RST).
  I use a SnowBallAnalyzer for text field in indexing.
  Perhaps the better way for me, is to use a text field with the value
ABC
  DEF_GHI  JKL_NOPQ where categorys are concatinated with a _.
  Thanks for your reply !
 
  Thierry.
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Indexing MS Files

2004-11-10 Thread Thierry Ferrero
I used OpenOffice API to convert all Word and Excel version.
For me it's the solution for complex Word and Excel document.
http://api.openoffice.org/
Good luck !

// UNO API
import com.sun.star.bridge.XUnoUrlResolver;
import com.sun.star.uno.XComponentContext;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XStorable;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.connection.NoConnectException;
import com.sun.star.io.IOException;


/** This class implements a http servlet in order to convert an incoming
document
 * with help of a running OpenOffice.org and to push the converted file back
 * to the client.
 */
public class DocConverter {

 private String stringHost;
 private String stringPort;
 private Xcontext xcontext;
 private Xbase xbase;

 public DocConverter(Xbase xbase,Xcontext xcontext,ServletContext sc) {

  this.xbase=xbase;
  this.xcontext=xcontext;
stringHost=ApplicationUtil.getParameter(sc,openoffice.oohost);
stringPort=ApplicationUtil.getParameter(sc,openoffice.ooport);
   }

 public synchronized String convertToTxt(String namedoc, String pathdoc,
String stringConvertType, String stringExtension) {

String stringConvertedFile = this.convertDocument(namedoc, pathdoc,
stringConvertType, stringExtension);
  return stringConvertedFile;
 }


 /** This method converts a document to a given type by using a running
 * OpenOffice.org and saves the converted document to the specified
 * working directory.
 * @param stringDocumentName The full path name of the file on the server to
be converted.
 * @param stringConvertType Type to convert to.
 * @param stringExtension This string will be appended to the file name of
the converted file.
 * @return The full path name of the converted file will be returned.
 * @see stringWorkingDirectory
 */
 private String convertDocument(String namedoc, String pathdoc, String
stringConvertType, String stringExtension ) {

 String tagerr=;
String stringUrl=;
String stringConvertedFile = ;
// Converting the document to the favoured type
try {
  tagerr=0;
  // Composing the URL - suppression de l'extension
  stringUrl = pathdoc+/+namedoc;
 stringUrl=stringUrl.replace( '\\', '/' );
  /* Bootstraps a component context with the jurt base components
 registered. Component context to be granted to a component for
running.
 Arbitrary values can be retrieved from the context. */
  XComponentContext xcomponentcontext =
  com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(
null );

  /* Gets the service manager instance to be used (or null). This method
has
 been added for convenience, because the service manager is a often
used
 object. */
  XMultiComponentFactory xmulticomponentfactory =
  xcomponentcontext.getServiceManager();
   tagerr=2;
  /* Creates an instance of the component UnoUrlResolver which
 supports the services specified by the factory. */
  Object objectUrlResolver =
  xmulticomponentfactory.createInstanceWithContext(
  com.sun.star.bridge.UnoUrlResolver, xcomponentcontext );
   // Create a new url resolver
  XUnoUrlResolver xurlresolver = ( XUnoUrlResolver )
  UnoRuntime.queryInterface( XUnoUrlResolver.class,
  objectUrlResolver );
// Resolves an object that is specified as follow:
  // uno:connection description;protocol description;initial object
name
  Object objectInitial = xurlresolver.resolve(
  uno:socket,host= + stringHost + ,port= + stringPort +
;urp;StarOffice.ServiceManager );

  // Create a service manager from the initial object
  xmulticomponentfactory = ( XMultiComponentFactory )
  UnoRuntime.queryInterface( XMultiComponentFactory.class,
objectInitial );
  // Query for the XPropertySet interface.
  XPropertySet xpropertysetMultiComponentFactory = ( XPropertySet )
  UnoRuntime.queryInterface( XPropertySet.class,
xmulticomponentfactory );
   // Get the default context from the office server.
  Object objectDefaultContext =
  xpropertysetMultiComponentFactory.getPropertyValue(
DefaultContext );

  // Query for the interface XComponentContext.
  xcomponentcontext = ( XComponentContext ) UnoRuntime.queryInterface(
  XComponentContext.class, objectDefaultContext );

  /* A desktop environment contains tasks with one or more
 frames in which components can be loaded. Desktop is the
 environment for components which can instanciate within
 frames. */
  XComponentLoader xcomponentloader = ( XComponentLoader )
  UnoRuntime.queryInterface( XComponentLoader.class,
  xmulticomponentfactory.createInstanceWithContext(
  com.sun.star.frame.Desktop, xcomponentcontext ) );

  // Preparing properties for 

Searching in keyword field ?

2004-11-09 Thread Thierry Ferrero (Itldev.info)
Hi All,

Can i search only one word in a keyword field which contains few words.
I know keyword field isn't tokenized. After many tests, i think is
impossible.
Someone can confirm me ?

Why don't i use a text field? because the users know the category from a
list (ex: category ABC, category DEF GHI, category  JKL ...) and the keyword
field 'category' can contains severals terms (ABC, DEF GHI, OPQ RST).
I use a SnowBallAnalyzer for text field in indexing.
Perhaps the better way for me, is to use a text field with the value ABC
DEF_GHI  JKL_NOPQ where categorys are concatinated with a _.
Thanks for your reply !

Thierry.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]