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

📄 lucenesearcher.java

📁 java编写的lucene环境下的搜多引擎的源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * LuceneSearcher.java * * Created on 2008年7月11日, 上午9:50 */package lucenesearch;import java.io.*;import javax.swing.JOptionPane;import javax.swing.JFileChooser;import java.awt.event.*;import java.awt.Rectangle;import javax.swing.DefaultListModel;/** * * @author  BileiZhu */public class LuceneSearcher extends javax.swing.JFrame {    private String indexDir1 = "";    private String indexDir2 = "";    private String dataDir = "";    private String keyWords = "";    private DefaultListModel model1 = new DefaultListModel();    /** Creates new form LuceneSearcher */    public LuceneSearcher() {        initComponents();        addMouseEvent();    }    /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */    @SuppressWarnings("unchecked")    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents    private void initComponents() {        buttonGroup1 = new javax.swing.ButtonGroup();        buttonGroup2 = new javax.swing.ButtonGroup();        jPanel1 = new javax.swing.JPanel();        jLabel1 = new javax.swing.JLabel();        jLabel2 = new javax.swing.JLabel();        jTextField1 = new javax.swing.JTextField();        jTextField2 = new javax.swing.JTextField();        jButton1 = new javax.swing.JButton();        jButton2 = new javax.swing.JButton();        jButton3 = new javax.swing.JButton();        jPanel2 = new javax.swing.JPanel();        jLabel3 = new javax.swing.JLabel();        jTextField3 = new javax.swing.JTextField();        jButton4 = new javax.swing.JButton();        jButton6 = new javax.swing.JButton();        jRadioButton1 = new javax.swing.JRadioButton();        jRadioButton2 = new javax.swing.JRadioButton();        jRadioButton3 = new javax.swing.JRadioButton();        jRadioButton4 = new javax.swing.JRadioButton();        jLabel4 = new javax.swing.JLabel();        jTextField4 = new javax.swing.JTextField();        jLabel5 = new javax.swing.JLabel();        jLabel6 = new javax.swing.JLabel();        jScrollPane1 = new javax.swing.JScrollPane();        jList1 = new javax.swing.JList();        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);        setTitle("LuceneSearcher");        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());        jLabel1.setText("数据文件夹");        jLabel2.setText("索引文件夹");        jButton1.setText("加载");        jButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton1ActionPerformed(evt);            }        });        jButton2.setText("加载");        jButton2.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton2ActionPerformed(evt);            }        });        jButton3.setText("建立索引");        jButton3.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton3ActionPerformed(evt);            }        });        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);        jPanel1.setLayout(jPanel1Layout);        jPanel1Layout.setHorizontalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)                    .addComponent(jButton3)                    .addGroup(jPanel1Layout.createSequentialGroup()                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                            .addComponent(jLabel1)                            .addComponent(jLabel2))                        .addGap(18, 18, 18)                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)                            .addComponent(jTextField2)                            .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE))                        .addGap(18, 18, 18)                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                            .addComponent(jButton1)                            .addComponent(jButton2))))                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        jPanel1Layout.setVerticalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel1)                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(jButton1))                .addGap(18, 18, 18)                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel2)                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(jButton2))                .addGap(18, 18, 18)                .addComponent(jButton3)                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());        jLabel3.setText("索引文件夹");        jButton4.setText("加载");        jButton4.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton4ActionPerformed(evt);            }        });        jButton6.setText("搜索");        jButton6.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton6ActionPerformed(evt);            }        });        buttonGroup1.add(jRadioButton1);        jRadioButton1.setSelected(true);        jRadioButton1.setText("全文");        buttonGroup1.add(jRadioButton2);        jRadioButton2.setText("标题");        buttonGroup2.add(jRadioButton3);        jRadioButton3.setText("升序");        buttonGroup2.add(jRadioButton4);        jRadioButton4.setSelected(true);        jRadioButton4.setText("降序");        jLabel4.setText("请输入关键字");        jLabel5.setText("搜索类型");        jLabel6.setText("输出方式");        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);        jPanel2.setLayout(jPanel2Layout);        jPanel2Layout.setHorizontalGroup(            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel2Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addGroup(jPanel2Layout.createSequentialGroup()                        .addComponent(jLabel5)                        .addGap(18, 18, 18)                        .addComponent(jRadioButton1)                        .addGap(0, 0, 0)                        .addComponent(jRadioButton2)                        .addGap(41, 41, 41)                        .addComponent(jLabel6)                        .addGap(18, 18, 18)                        .addComponent(jRadioButton3)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jRadioButton4))                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()                            .addComponent(jLabel4)                            .addGap(18, 18, 18)                            .addComponent(jTextField4)                            .addGap(18, 18, 18)                            .addComponent(jButton6))                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()                            .addComponent(jLabel3)                            .addGap(18, 18, 18)                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)                            .addGap(18, 18, 18)                            .addComponent(jButton4))))                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        jPanel2Layout.setVerticalGroup(            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel2Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel3)                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(jButton4))                .addGap(18, 18, 18)                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel5)                    .addComponent(jRadioButton1)                    .addComponent(jRadioButton2)                    .addComponent(jLabel6)                    .addComponent(jRadioButton3)                    .addComponent(jRadioButton4))                .addGap(18, 18, 18)

⌨️ 快捷键说明

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