⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchfiles.java

📁 反ajax原代码
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   SearchFiles.java

package com.laoer.bbscs.lucene;

import java.io.*;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.*;

class SearchFiles
{

    SearchFiles()
    {
    }

    public static void main(String args[])
    {
        Searcher searcher;
        org.apache.lucene.analysis.Analyzer analyzer;
        BufferedReader in;
        searcher = new IndexSearcher("index");
        analyzer = new StandardAnalyzer();
        in = new BufferedReader(new InputStreamReader(System.in));
_L2:
        String line;
        Hits hits;
        int start;
        System.out.print("Query: ");
        line = in.readLine();
        if(line.length() == -1)
            break MISSING_BLOCK_LABEL_411;
        Query query = QueryParser.parse(line, "contents", analyzer);
        System.out.println("Searching for: " + query.toString("contents"));
        hits = searcher.search(query);
        System.out.println(hits.length() + " total matching documents");
        int HITS_PER_PAGE = 10;
        start = 0;
_L4:
        if(start >= hits.length()) goto _L2; else goto _L1
_L1:
        int end = Math.min(hits.length(), start + 10);
        for(int i = start; i < end; i++)
        {
            Document doc = hits.doc(i);
            String path = doc.get("path");
            if(path != null)
            {
                System.out.println(i + ". " + path);
                continue;
            }
            String url = doc.get("url");
            if(url != null)
            {
                System.out.println(i + ". " + url);
                System.out.println("   - " + doc.get("title"));
            } else
            {
                System.out.println(i + ". " + "No path nor URL for this document");
            }
        }

        if(hits.length() <= end)
            break; /* Loop/switch isn't completed */
        System.out.print("more (y/n) ? ");
        line = in.readLine();
        if(line.length() != 0 && line.charAt(0) != 'n') goto _L3; else goto _L2
_L3:
        start += 10;
          goto _L4
        searcher.close();
        break MISSING_BLOCK_LABEL_459;
        Exception e;
        e;
        System.out.println(" caught a " + e.getClass() + "\n with message: " + e.getMessage());
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -