lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Babak Bastan <babak...@gmail.com>
Subject Lucene index files are empty
Date Mon, 26 Aug 2013 11:43:32 GMT
I want to umplement full text search using Lucene and Hibernate search. As
I understand, Lucene creats two files. These two files should be contain
some text data, but my index files are empty ( I open these two files with
Luke)

[image: Inline image 1]
here is my code:

@Entity@Indexed@Table(name="Users")@GenericGenerator(name="mongodb_uuidgg",strategy
= "uuid2")public class User implements Serializable{
    private static final long serialVersionUID=1L;
    @DocumentId
    @Id
    @GeneratedValue(generator="mongodb_uuidgg")
  //  @Column(name="id")
   @Field(index = Index.YES,analyze = Analyze.YES,store = Store.YES)
    private String  id;

    @Column(name="City")
    @Field(index = Index.YES,analyze = Analyze.YES,store = Store.YES)
    private String city;

    @Column(name="UserID")
    @NumericField
    @Field(index = Index.YES,analyze = Analyze.NO,store = Store.YES)
    private int IdU

and in DAO I have this block of code:

OgmConfiguration cfgogm=new OgmConfiguration();
        cfgogm.configure("hibernate.cfg.xml");
        serviceregistry=new
ServiceRegistryBuilder().applySettings(cfgogm.getProperties()).buildServiceRegistry();
        sessionfactory=cfgogm.buildSessionFactory(serviceregistry);


        sessionfactory.openSession();
        FullTextSession fulltextsession=
Search.getFullTextSession(sessionfactory.getCurrentSession());
        QueryBuilder
querybuilder=fulltextsession.getSearchFactory().buildQueryBuilder().forEntity(User.class).get();
        org.apache.lucene.search.Query
lucenequery=querybuilder.keyword().onField("IdU").matching(new
Integer(87709)).createQuery();

        org.hibernate.search.FullTextQuery
fulltextquery=fulltextsession.createFullTextQuery(
lucenequery,User.class );
        fulltextquery.initializeObjectsWith(ObjectLookupMethod.SKIP,
DatabaseRetrievalMethod.FIND_BY_ID);
        List result=fulltextquery.list();
        System.out.println(result.size());

could you please say me, what is my mistake?

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message