IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JDBC Java Discussion :

Probléme : Create Lucene Index in database using JdbcDirectory


Sujet :

JDBC Java

  1. #1
    Futur Membre du Club
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2013
    Messages : 7
    Points : 5
    Points
    5
    Par défaut Probléme : Create Lucene Index in database using JdbcDirectory
    j'arrive pas à enregistrer les index dans la base de données que se soit Postgresql ou Mysql

    Mon but est d'enregistrer les index des champs extraite depuis la table users (id,name,lastname) dans une autre table nommée LUCENE_INDEX_TABLE.
    j'utilise lucene 3.6.1, compass 2.2.0 et postgresql 9.2 et j'ai testé aussi avec mysql
    mais toujours j'ai le même probléme :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    org.apache.lucene.store.jdbc.JdbcStoreException: Failed to execute sql [insert into LUCENE_INDEX_TABLE (name_, value_, size_, lf_, deleted_) values ( ?, ?, ?, current_timestamp, ? )]; nested exception is org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
    org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
    at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:239)
    at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:226)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.setBlob(AbstractJdbc2Statement.java:3048)
    at org.apache.lucene.store.jdbc.index.AbstractJdbcIndexOutput$1.fillPrepareStatement(AbstractJdbcIndexOutput.java:55)
    at org.apache.lucene.store.jdbc.support.JdbcTemplate.executeUpdate(JdbcTemplate.java:174)
    at org.apache.lucene.store.jdbc.index.AbstractJdbcIndexOutput.close(AbstractJdbcIndexOutput.java:47)
    at org.apache.lucene.store.jdbc.index.RAMAndFileJdbcIndexOutput.close(RAMAndFileJdbcIndexOutput.java:81)
    at org.apache.lucene.util.IOUtils.close(IOUtils.java:141)
    at org.apache.lucene.index.FieldsWriter.close(FieldsWriter.java:139)
    at org.apache.lucene.index.StoredFieldsWriter.flush(StoredFieldsWriter.java:55)
    at org.apache.lucene.index.DocFieldProcessor.flush(DocFieldProcessor.java:59)
    at org.apache.lucene.index.DocumentsWriter.flush(DocumentsWriter.java:581)
    at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3587)
    at org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:3376)
    at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3485)
    at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3467)
    at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3451)
    at test.lucene.chaima.JDBCIndexer.addIndex(JDBCIndexer.java:137)
    at test.lucene.chaima.JDBCIndexer.index(JDBCIndexer.java:92)
    at test.lucene.chaima.JDBCIndexer.createAndBuildIndex(JDBCIndexer.java:78)
    at test.lucene.chaima.JDBCIndexer.buildIndex(JDBCIndexer.java:69)
    at test.lucene.chaima.JDBCIndexer.main(JDBCIndexer.java:172)
    org.apache.lucene.store.jdbc.JdbcStoreException: Failed to execute sql [insert into LUCENE_INDEX_TABLE (name_, value_, size_, lf_, deleted_) values ( ?, ?, ?, current_timestamp, ? )]; nested exception is org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
    org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
    at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:239)
    at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:226)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.setBlob(AbstractJdbc2Statement.java:3048)
    at org.apache.lucene.store.jdbc.index.AbstractJdbcIndexOutput$1.fillPrepareStatement(AbstractJdbcIndexOutput.java:55)
    at org.apache.lucene.store.jdbc.support.JdbcTemplate.executeUpdate(JdbcTemplate.java:174)
    at org.apache.lucene.store.jdbc.index.AbstractJdbcIndexOutput.close(AbstractJdbcIndexOutput.java:47)
    at org.apache.lucene.store.jdbc.index.RAMAndFileJdbcIndexOutput.close(RAMAndFileJdbcIndexOutput.java:81)
    at org.apache.lucene.store.ChecksumIndexOutput.close(ChecksumIndexOutput.java:61)
    at org.apache.lucene.index.SegmentInfos.finishCommit(SegmentInfos.java:863)
    at org.apache.lucene.index.IndexWriter.finishCommit(IndexWriter.java:3501)
    at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3490)
    at org.apache.lucene.index.IndexWriter.closeInternal(IndexWriter.java:1873)
    at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1812)
    at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1776)
    at test.lucene.chaima.JDBCIndexer.index(JDBCIndexer.java:102)
    at test.lucene.chaima.JDBCIndexer.createAndBuildIndex(JDBCIndexer.java:78)
    at test.lucene.chaima.JDBCIndexer.buildIndex(JDBCIndexer.java:69)
    at test.lucene.chaima.JDBCIndexer.main(JDBCIndexer.java:172)
    org.apache.lucene.index.IndexNotFoundException: no segments* file found in test.lucene.chaima.MyJDBCDirectory@9506dc4 lockFactory=null: files: [write.lock]
    at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:667)
    at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:72)
    at org.apache.lucene.index.IndexReader.open(IndexReader.java:256)
    at test.lucene.chaima.JDBCSearcher.search(JDBCSearcher.java:56)
    at test.lucene.chaima.JDBCIndexer.buildIndex(JDBCIndexer.java:70)
    at test.lucene.chaima.JDBCIndexer.main(JDBCIndexer.java:172)

    j'ai essayé plusieurs solutions que j'ai trouvé mais sans résoudre le probléme
    merci de m'aidez à trouver la solution.

  2. #2
    Futur Membre du Club
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2013
    Messages : 7
    Points : 5
    Points
    5
    Par défaut Create Lucene Index in database using JdbcDirectory
    j'attend encore une réponse
    qui peut m'aidez svp

  3. #3
    Modérateur

    Homme Profil pro
    Développeur java, access, sql server
    Inscrit en
    Octobre 2005
    Messages
    2 710
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur java, access, sql server
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2005
    Messages : 2 710
    Points : 4 794
    Points
    4 794
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Les Large Objects ne devraient pas être utilisés en mode auto-commit
    Tu as l'air de vouloir insérer quelque chose de très gros dans un seul champ.
    Quelles sont les "values" que tu passes à ta requête ?
    Labor improbus omnia vincit un travail acharné vient à bout de tout - Ambroise Paré (1510-1590)

    Consulter sans modération la FAQ ainsi que les bons ouvrages : http://jmdoudoux.developpez.com/cours/developpons/java/

  4. #4
    Futur Membre du Club
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2013
    Messages : 7
    Points : 5
    Points
    5
    Par défaut Create Lucene Index in database using JdbcDirectory
    ok merci Népomucène
    donc je t'explique le process
    j'ai une table users :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    CREATE TABLE users
    (
      id integer NOT NULL,
      name character(20),
      lastname character(20),
      CONSTRAINT pk_id PRIMARY KEY (id)
    )
    je voudrais indexer les champs id,name et lastname avec lucene et par la suite enregistrer dans la table lucene_index_table :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    CREATE TABLE lucene_index_table
    (
      name_ character varying(50) NOT NULL,
      value_ oid,
      size_ integer,
      lf_ timestamp without time zone,
      deleted_ boolean,
      CONSTRAINT lucene_index_table_pkey PRIMARY KEY (name_)
    )
    voilà la classe qui fait l'indexation :
    la méthode addIndex est responsable de l'indexation du contenu de la table users.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
     
    import org.apache.lucene.analysis.Analyzer;
    import org.apache.lucene.analysis.SimpleAnalyzer;
    import org.apache.lucene.document.Document;
    import org.apache.lucene.document.Field;
    import org.apache.lucene.index.CorruptIndexException;
    import org.apache.lucene.index.IndexWriter;
    import org.apache.lucene.index.IndexWriterConfig;
    import org.apache.lucene.store.Directory;
    import org.apache.lucene.store.LockObtainFailedException;
    import org.apache.lucene.store.jdbc.JdbcDirectory;
    import org.apache.lucene.store.jdbc.dialect.PostgreSQLDialect;
    import org.apache.lucene.util.Version;
     
    /**
     * The Class JDBCIndexer.
     * 
     * @author chaima
     */
    public class JDBCIndexer {
     
        /** The jdbc directory. */
        private Directory   jdbcDirectory   = null;
     
        /**
         * Instantiates a new jDBC indexer.
         * 
         * @param jdbcDirectory
         *            the jdbc directory
         */
        public JDBCIndexer(Directory jdbcDirectory) {
            super();
            this.jdbcDirectory = jdbcDirectory;
        }
        /**
         * Gets the jdbc directory.
         * 
         * @return the jdbc directory
         */
        public Directory getJdbcDirectory() {
            if (jdbcDirectory == null) {
                throw new IllegalStateException("Index not yet build, rerun indexing");
            }
            return jdbcDirectory;
        }
     
        /**
         * Sets the jdbc directory.
         * 
         * @param jdbcDirectory
         *            the new jdbc directory
         */
        public void setJdbcDirectory(Directory jdbcDirectory) {
            this.jdbcDirectory = jdbcDirectory;
        }
     
        /**
         * Builds the index.
         */
        public void buildIndex() {
            createAndBuildIndex();
        }
     
        /**
         * Creates the and build index.
         */
        private void createAndBuildIndex() {
           createIndexTable();
            index();
        }
     
        /**
         * Index.
         */
        private void index() {
            Analyzer analyzer = new SimpleAnalyzer(Version.LUCENE_36);
            IndexWriterConfig indexWriterConfig = new IndexWriterConfig(Version.LUCENE_36, analyzer);
            IndexWriter indexWriter = null;
            try {
                indexWriter = new IndexWriter(getJdbcDirectory(), analyzer,true, IndexWriter.MaxFieldLength.UNLIMITED);
                Boolean locked=indexWriter.isLocked(jdbcDirectory);
                System.out.println("locked **** "+locked);
                addIndex(indexWriter);
            } catch (CorruptIndexException e) {
                e.printStackTrace();
            } catch (LockObtainFailedException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (indexWriter != null) {
                    try {
                        indexWriter.close();
                    } catch (CorruptIndexException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    } finally {
                        indexWriter = null;
                    }
                }
            }
        }
     
        /**
         * Adds some record in BOOKS table
         * 
         * @param indexWriter
         *            the index writer
         */
        private void addIndex(IndexWriter indexWriter) throws CorruptIndexException, IOException {
         try {
          Connection connection = JDBCDatabaseUtil.getConnection();
          connection.setAutoCommit(false);
          String query = "SELECT id, name, lastname FROM users";
          PreparedStatement pstmt = connection.prepareStatement(query);
          ResultSet resultSet = pstmt.executeQuery();
          while (resultSet.next()) {
           Document document = new Document();
           System.out.println("id *** "+resultSet.getInt(1)+"name ****"+resultSet.getString(2)+"lastname **** "+resultSet.getString(3));
           System.out.println("auto commit 1*** "+connection.getAutoCommit());
           document.add(new Field("id", String.valueOf(resultSet.getInt(1)), Field.Store.YES, Field.Index.ANALYZED));
           document.add(new Field("name", String.valueOf(resultSet.getString(2)), Field.Store.YES, Field.Index.ANALYZED));
           document.add(new Field("lastname", String.valueOf(resultSet.getString(3)), Field.Store.YES, Field.Index.ANALYZED));
     
           indexWriter.addDocument(document);
           System.out.println("auto commit 2*** "+connection.getAutoCommit());    
           indexWriter.commit();
         }
         indexWriter.close();    
     
         } catch (SQLException e) {
          e.printStackTrace();
         }
        }
     
        /**
         * Creates the index table.
         */
        private void createIndexTable() {
            if (this.jdbcDirectory == null) {
                setJdbcDirectory(new MyJDBCDirectory(JDBCDatabaseUtil.getDataSource(), new PostgreSQLDialect(), "LUCENE_INDEX_TABLE"));
            }
            try {
                /**
                 * No need to manually create index table, create method will
                 * automatically create it.
                 */
               boolean existe= ((JdbcDirectory) getJdbcDirectory()).tableExists();
               if(existe)
            	   System.out.println("table existe");
               else{
            	   System.out.println("table non existe");
            	   ((JdbcDirectory) getJdbcDirectory()).create();  
               }
     
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
     
        public static void main(String[] args) {
        	new JDBCIndexer(null).buildIndex();
        }
    }

    la classe MyJDBCDirectory :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    import java.io.IOException;
     
    import javax.sql.DataSource;
     
    import org.apache.lucene.store.jdbc.JdbcDirectory;
    import org.apache.lucene.store.jdbc.JdbcDirectorySettings;
    import org.apache.lucene.store.jdbc.JdbcStoreException;
    import org.apache.lucene.store.jdbc.dialect.Dialect;
    import org.apache.lucene.store.jdbc.support.JdbcTable;
     
    /**
     * The Class MyJDBCDirectory.
     * 
     * @author prabhat.jha
     */
    public class MyJDBCDirectory extends JdbcDirectory {
     
        /**
         * Instantiates a new my jdbc directory.
         * 
         * @param dataSource
         *            the data source
         * @param dialect
         *            the dialect
         * @param settings
         *            the settings
         * @param tableName
         *            the table name
         */
        public MyJDBCDirectory(DataSource dataSource, Dialect dialect, JdbcDirectorySettings settings, String tableName) {
            super(dataSource, dialect, settings, tableName);
        }
     
        /**
         * Instantiates a new my jdbc directory.
         *
         * @param dataSource the data source
         * @param dialect the dialect
         * @param tableName the table name
         */
        public MyJDBCDirectory(DataSource dataSource, Dialect dialect, String tableName) {
            super(dataSource, dialect, tableName);
        }
     
        /**
         * Instantiates a new my jdbc directory.
         *
         * @param dataSource the data source
         * @param settings the settings
         * @param tableName the table name
         * @throws JdbcStoreException the jdbc store exception
         */
        public MyJDBCDirectory(DataSource dataSource, JdbcDirectorySettings settings, String tableName) throws JdbcStoreException {
            super(dataSource, settings, tableName);
        }
     
        /**
         * Instantiates a new my jdbc directory.
         *
         * @param dataSource the data source
         * @param table the table
         */
        public MyJDBCDirectory(DataSource dataSource, JdbcTable table) {
            super(dataSource, table);
        }
     
        /**
         * Instantiates a new my jdbc directory.
         *
         * @param dataSource the data source
         * @param tableName the table name
         * @throws JdbcStoreException the jdbc store exception
         */
        public MyJDBCDirectory(DataSource dataSource, String tableName) throws JdbcStoreException {
            super(dataSource, tableName);
        }
     
        /**
         * (non-Javadoc).
         *
         * @return the string[]
         * @throws IOException Signals that an I/O exception has occurred.
         * @see org.apache.lucene.store.Directory#listAll()
         */
        @Override
        public String[] listAll() throws IOException {
            return super.list();
        }
     
    }

    et la classe JDBCDatabaseUtil:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    import java.sql.Connection;
    import java.sql.SQLException;
     
    import javax.sql.DataSource;
     
    import org.postgresql.ds.PGPoolingDataSource;
    import org.postgresql.ds.PGSimpleDataSource;
     
     
    //import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
     
     
    /**
     * The Class JDBCDatabaseUtil.
     * @author prabhat.jha
     */
    public class JDBCDatabaseUtil {
        /**
         * Gets the data source.
         * 
         * @return the data source
         */
        public static DataSource getDataSource() {
        	PGSimpleDataSource dataSource = new PGSimpleDataSource();
        	dataSource.setUser("postgres");  
    		dataSource.setPassword("root");  
    		dataSource.setDatabaseName("postgres");
    		return dataSource;
        }
     
        /**
         * Gets the connection.
         * 
         * @return the connection
         * @throws SQLException
         *             the sQL exception
         */
        public static Connection getConnection() throws SQLException {
            return getDataSource().getConnection();
        }
    }

  5. #5
    Modérateur

    Homme Profil pro
    Développeur java, access, sql server
    Inscrit en
    Octobre 2005
    Messages
    2 710
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur java, access, sql server
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2005
    Messages : 2 710
    Points : 4 794
    Points
    4 794
    Par défaut
    Désolé c'est illisible !
    il faut mettre le code dans la balise code cad le symbole # de la barre d'outil !!!
    et de l'indentation ne serait pas du luxe ...
    Labor improbus omnia vincit un travail acharné vient à bout de tout - Ambroise Paré (1510-1590)

    Consulter sans modération la FAQ ainsi que les bons ouvrages : http://jmdoudoux.developpez.com/cours/developpons/java/

  6. #6
    Futur Membre du Club
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2013
    Messages : 7
    Points : 5
    Points
    5
    Par défaut Create Lucene Index in database using JdbcDirectory
    oui Népomucène j'ai oublié les balises codes

  7. #7
    Modérateur

    Homme Profil pro
    Développeur java, access, sql server
    Inscrit en
    Octobre 2005
    Messages
    2 710
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur java, access, sql server
    Secteur : Industrie

    Informations forums :
    Inscription : Octobre 2005
    Messages : 2 710
    Points : 4 794
    Points
    4 794
    Par défaut
    C'est assez curieux, j'ai l'impression que cela n'a rien à voir avec LUCENE mais plutôt dans la boucle de lecture de la base.
    Est-ce que l'instruction ligne 125 de JDBCIndexer :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    System.out.println("id *** "+resultSet.getInt(1)+"name ****"+resultSet.getString(2)+"lastname **** "+resultSet.getString(3));
    est exécutée ?
    Labor improbus omnia vincit un travail acharné vient à bout de tout - Ambroise Paré (1510-1590)

    Consulter sans modération la FAQ ainsi que les bons ouvrages : http://jmdoudoux.developpez.com/cours/developpons/java/

  8. #8
    Futur Membre du Club
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2013
    Messages : 7
    Points : 5
    Points
    5
    Par défaut Create Lucene Index in database using JdbcDirectory
    oui Népomucène, cette ligne je l'ai mis juste pour vérifier que mon code est entrain de récupérer les données depuis la table users
    le problème est lors de l'enregistrement des index dans la table lucene_index_table

    voilà ce que j’obtiens lorsque j'exécute ce code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    table non existe
    locked **** true
    id *** 1name ****chaima              lastname **** chaima              
    auto commit 1*** false
    auto commit 2*** false
    org.apache.lucene.store.jdbc.JdbcStoreException: Failed to execute sql [insert into LUCENE_INDEX_TABLE (name_, value_, size_, lf_, deleted_) values ( ?, ?, ?, current_timestamp, ? )]; nested exception is org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
    org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
    	at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:239)
    	at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:226)
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.setBlob(AbstractJdbc2Statement.java:3048)
    	at org.apache.lucene.store.jdbc.index.AbstractJdbcIndexOutput$1.fillPrepareStatement(AbstractJdbcIndexOutput.java:55)
    	at org.apache.lucene.store.jdbc.support.JdbcTemplate.executeUpdate(JdbcTemplate.java:174)
    	at org.apache.lucene.store.jdbc.index.AbstractJdbcIndexOutput.close(AbstractJdbcIndexOutput.java:47)
    	at org.apache.lucene.store.jdbc.index.RAMAndFileJdbcIndexOutput.close(RAMAndFileJdbcIndexOutput.java:81)
    	at org.apache.lucene.util.IOUtils.close(IOUtils.java:141)
    	at org.apache.lucene.index.FieldsWriter.close(FieldsWriter.java:139)
    	at org.apache.lucene.index.StoredFieldsWriter.flush(StoredFieldsWriter.java:55)
    	at org.apache.lucene.index.DocFieldProcessor.flush(DocFieldProcessor.java:59)
    	at org.apache.lucene.index.DocumentsWriter.flush(DocumentsWriter.java:581)
    	at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3587)
    	at org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:3376)
    	at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3485)
    	at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3467)
    	at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3451)
    	at test.lucene.chaima.JDBCIndexer.addIndex(JDBCIndexer.java:136)
    	at test.lucene.chaima.JDBCIndexer.index(JDBCIndexer.java:91)
    	at test.lucene.chaima.JDBCIndexer.createAndBuildIndex(JDBCIndexer.java:77)
    	at test.lucene.chaima.JDBCIndexer.buildIndex(JDBCIndexer.java:68)
    	at test.lucene.chaima.JDBCIndexer.main(JDBCIndexer.java:171)
    org.apache.lucene.store.jdbc.JdbcStoreException: Failed to execute sql [insert into LUCENE_INDEX_TABLE (name_, value_, size_, lf_, deleted_) values ( ?, ?, ?, current_timestamp, ? )]; nested exception is org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
    org.postgresql.util.PSQLException: Les Large Objects ne devraient pas être utilisés en mode auto-commit.
    	at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:239)
    	at org.postgresql.largeobject.LargeObjectManager.createLO(LargeObjectManager.java:226)
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.setBlob(AbstractJdbc2Statement.java:3048)
    	at org.apache.lucene.store.jdbc.index.AbstractJdbcIndexOutput$1.fillPrepareStatement(AbstractJdbcIndexOutput.java:55)
    	at org.apache.lucene.store.jdbc.support.JdbcTemplate.executeUpdate(JdbcTemplate.java:174)
    	at org.apache.lucene.store.jdbc.index.AbstractJdbcIndexOutput.close(AbstractJdbcIndexOutput.java:47)
    	at org.apache.lucene.store.jdbc.index.RAMAndFileJdbcIndexOutput.close(RAMAndFileJdbcIndexOutput.java:81)
    	at org.apache.lucene.store.ChecksumIndexOutput.close(ChecksumIndexOutput.java:61)
    	at org.apache.lucene.index.SegmentInfos.finishCommit(SegmentInfos.java:863)
    	at org.apache.lucene.index.IndexWriter.finishCommit(IndexWriter.java:3501)
    	at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3490)
    	at org.apache.lucene.index.IndexWriter.closeInternal(IndexWriter.java:1873)
    	at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1812)
    	at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1776)
    	at test.lucene.chaima.JDBCIndexer.index(JDBCIndexer.java:101)
    	at test.lucene.chaima.JDBCIndexer.createAndBuildIndex(JDBCIndexer.java:77)
    	at test.lucene.chaima.JDBCIndexer.buildIndex(JDBCIndexer.java:68)
    	at test.lucene.chaima.JDBCIndexer.main(JDBCIndexer.java:171)

  9. #9
    Futur Membre du Club
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2013
    Messages : 7
    Points : 5
    Points
    5
    Par défaut Create Lucene Index in database using JdbcDirectory
    Bonjour voilà le code source de l'applicationhttp://depositfiles.com/files/e11usy50u que je veux l’exécuter je l'ai mis pour faciliter la tâche

    il suffit de créer un base de données qui s'appelle postgres
    et une table users et d'insérer quelque ligne

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    CREATE TABLE users
    (
      id integer NOT NULL,
      name character(20),
      lastname character(20),
      CONSTRAINT pk_id PRIMARY KEY (id)
    )
    WITH (
      OIDS=FALSE
    );
    ALTER TABLE users
      OWNER TO postgres;
    la classe JDBCDatabaseUtil contient la configuration.

    vous pouvez télécharger le code source depuis cette url http://depositfiles.com/files/e11usy50u
    j'attends votre aide

  10. #10
    Futur Membre du Club
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2013
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Femme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2013
    Messages : 7
    Points : 5
    Points
    5
    Par défaut Create Lucene Index in database using JdbcDirectory
    Personne ne peut m'aider

Discussions similaires

  1. [CSS]Problème de z-index
    Par Pill_S dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 20/02/2006, 20h03
  2. Problème avec les indexes sur une base de données.
    Par osoudee dans le forum MS SQL Server
    Réponses: 1
    Dernier message: 09/02/2006, 09h24
  3. problème avec z-index sous firefox ???
    Par SpaceFrog dans le forum Balisage (X)HTML et validation W3C
    Réponses: 3
    Dernier message: 22/09/2005, 20h39
  4. problème au niveau de restore database
    Par Redouane dans le forum Administration
    Réponses: 2
    Dernier message: 07/09/2005, 11h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo