Package org.apache.lucene.store

Examples of org.apache.lucene.store.FSDirectory$FSIndexInput$Descriptor


            File f=new File(s1);
            if(!f.exists())
            {
              continue;
            }
            FSDirectory d=LinkFSDirectory.open(f);
            DirectoryInfo info=new DirectoryInfo();
            info.d=d;
            info.tp=DirectoryInfo.DirTpe.file;
            diskDirector.put(s1, info);
            SolrCore.log.info(">>>>>LinkFSDirectory readOnlyOpen add links "+s1);
View Full Code Here


      sb.append("commit{");

      Directory dir = commit.getDirectory();

      if (dir instanceof FSDirectory) {
        FSDirectory fsd = (FSDirectory) dir;
        sb.append("dir=").append(fsd.getDirectory());
      }else if (dir instanceof FileSystemDirectory) {
        FileSystemDirectory fsd = (FileSystemDirectory) dir;
          sb.append("dir=").append(fsd.directory.toString());
        }else {
        sb.append("dir=").append(dir);
View Full Code Here

  public String getSigmentUniqKey()
  {
    StringBuffer buffer=new StringBuffer();
    buffer.append(si.name).append("@");
    if(core.dir instanceof FSDirectory){
        FSDirectory dddir=(FSDirectory)core.dir;
        buffer.append(dddir.getDirectory().getAbsolutePath()).append("@");
      }else if(core.dir instanceof FileSystemDirectory){
        FileSystemDirectory dddir=(FileSystemDirectory)core.dir;
        buffer.append("@hdfs@"+dddir.directory.toString()).append("@");
      }
      else if(core.dir instanceof RAMDirectory){
View Full Code Here

    Directory dir = commit.getDirectory();

    // For anything persistent, make something that will
    // be the same, regardless of the Directory instance.
    if (dir instanceof FSDirectory) {
      FSDirectory fsd = (FSDirectory) dir;
      File fdir = fsd.getDirectory();
      sb.append(fdir.getPath());
    } else {
      sb.append(dir);
    }
View Full Code Here

    private static void index(String indexDir, Map<String,List<String>> word2Nums, Map<String,List<String>> num2Words)
        throws Throwable
    {
        int row = 0;
        int mod = 1;
        FSDirectory dir = FSDirectory.open(new File(indexDir));
        try {

          // override the specific index if it already exists
          IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
              Version.LUCENE_CURRENT, ana).setOpenMode(OpenMode.CREATE));
          ((TieredMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(true); // why?
          Iterator<String> i1 = word2Nums.keySet().iterator();
          while (i1.hasNext()) // for each word
          {
              String g = i1.next();
              Document doc = new Document();

              int n = index(word2Nums, num2Words, g, doc);
              if (n > 0)
              {
          doc.add( new Field( F_WORD, g, Field.Store.YES, Field.Index.NOT_ANALYZED));
                  if ((++row % mod) == 0)
                  {
                      o.println("\trow=" + row + "/" + word2Nums.size() + " doc= " + doc);
                      mod *= 2;
                  }
                  writer.addDocument(doc);
              } // else degenerate
          }
          o.println( "Optimizing..");
          writer.optimize();
          writer.close();
        } finally {
          dir.close();
        }
    }
View Full Code Here

  public static final int DEFAULTnumTerms = 100;
  public static int numTerms = DEFAULTnumTerms;
 
  public static void main(String[] args) throws Exception {
    IndexReader reader = null;
    FSDirectory dir = null;
    String field = null;
    boolean IncludeTermFreqs = false;
  
    if (args.length == 0 || args.length > 4) {
      usage();
View Full Code Here

    {
      System.out.println(
                 "java org.apache.lucene.wordnet.SynExpand <index path> <query>");
    }

    FSDirectory directory = FSDirectory.open(new File(args[0]));
    IndexSearcher searcher = new IndexSearcher(directory, true);

    String query = args[1];
    String field = "contents";

    Query q = expand( query, searcher, new StandardAnalyzer(Version.LUCENE_CURRENT), field, 0.9f);
    System.out.println( "Query: " + q.toString( field));



    searcher.close();
    directory.close();
  }
View Full Code Here

    if (args.length != 2) {
      System.out.println(
                 "java org.apache.lucene.wordnet.SynLookup <index path> <word>");
    }

    FSDirectory directory = FSDirectory.open(new File(args[0]));
    IndexSearcher searcher = new IndexSearcher(directory, true);

    String word = args[1];
    Query query = new TermQuery(new Term(Syns2Index.F_WORD, word));
    CountingCollector countingCollector = new CountingCollector();
    searcher.search(query, countingCollector);

    if (countingCollector.numHits == 0) {
      System.out.println("No synonyms found for " + word);
    } else {
      System.out.println("Synonyms found for \"" + word + "\":");
    }

    ScoreDoc[] hits = searcher.search(query, countingCollector.numHits).scoreDocs;
   
    for (int i = 0; i < hits.length; i++) {
      Document doc = searcher.doc(hits[i].doc);

      String[] values = doc.getValues(Syns2Index.F_SYN);

      for (int j = 0; j < values.length; j++) {
        System.out.println(values[j]);
      }
    }

    searcher.close();
    directory.close();
  }
View Full Code Here

    infos.commit(fsDir);
  }

  public void split(File destDir, String[] segs) throws IOException {
    destDir.mkdirs();
    FSDirectory destFSDir = FSDirectory.open(destDir);
    SegmentInfos destInfos = new SegmentInfos();
    destInfos.counter = infos.counter;
    for (String n : segs) {
      SegmentInfo info = getInfo(n);
      destInfos.add(info);
View Full Code Here

                url = new URL(a[++i]);
            }
        }

        PrintStream o = System.out;
        FSDirectory dir = FSDirectory.open(new File(indexName));
        IndexReader r = IndexReader.open(dir, true);
        o.println("Open index " + indexName + " which has " + r.numDocs() + " docs");

        MoreLikeThis mlt = new MoreLikeThis(r);
View Full Code Here

TOP

Related Classes of org.apache.lucene.store.FSDirectory$FSIndexInput$Descriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.