Added option to show keyword snippets or not.

This commit is contained in:
Jeff Wallace 2013-12-06 15:45:36 -05:00
parent 67d2f81252
commit c88ea02a07
5 changed files with 45 additions and 10 deletions

View File

@ -88,3 +88,4 @@ KeywordSearchListsViewerPanel.manageListsButton.toolTipText=Manage keyword lists
KeywordSearchConfigurationPanel2.frequencyLabel.text=Results update frequency during ingest:
KeywordSearchConfigurationPanel2.timeRadioButton4.text_1=1 minute (faster feedback, longest ingest)
KeywordSearchConfigurationPanel2.timeRadioButton4.toolTipText=1 minute (overall ingest time will be longest)
KeywordSearchConfigurationPanel2.showSnippetsCB.text=Show Keyword Preview in Keyword Search Results (will result in longer search times)

View File

@ -20,7 +20,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
@ -34,14 +34,15 @@
<Component id="informationSeparator" min="-2" pref="309" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="skipNSRLCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="showSnippetsCB" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="filesIndexedLabel" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="141" max="-2" attributes="0"/>
<Component id="filesIndexedValue" min="-2" pref="104" max="-2" attributes="0"/>
</Group>
<Component id="skipNSRLCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="frequencyLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
@ -74,7 +75,9 @@
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="skipNSRLCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="showSnippetsCB" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="frequencyLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="timeRadioButton1" min="-2" max="-2" attributes="0"/>
@ -99,7 +102,7 @@
<Component id="chunksLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="chunksValLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="30" max="32767" attributes="0"/>
<EmptySpace pref="116" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -211,5 +214,12 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="showSnippetsCB">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchConfigurationPanel2.showSnippetsCB.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -44,6 +44,7 @@ public class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel impleme
private void activateWidgets() {
skipNSRLCheckBox.setSelected(KeywordSearchSettings.getSkipKnown());
showSnippetsCB.setSelected(KeywordSearchSettings.getShowSnippets());
boolean enable = !IngestManager.getDefault().isIngestRunning()
&& !IngestManager.getDefault().isModuleRunning(KeywordSearchIngestModule.getDefault());
skipNSRLCheckBox.setEnabled(enable);
@ -96,6 +97,7 @@ public class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel impleme
timeRadioButton2 = new javax.swing.JRadioButton();
timeRadioButton3 = new javax.swing.JRadioButton();
timeRadioButton4 = new javax.swing.JRadioButton();
showSnippetsCB = new javax.swing.JCheckBox();
skipNSRLCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.skipNSRLCheckBox.text")); // NOI18N
skipNSRLCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.skipNSRLCheckBox.toolTipText")); // NOI18N
@ -127,6 +129,8 @@ public class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel impleme
timeRadioButton4.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton4.text_1")); // NOI18N
timeRadioButton4.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.timeRadioButton4.toolTipText")); // NOI18N
showSnippetsCB.setText(org.openide.util.NbBundle.getMessage(KeywordSearchConfigurationPanel2.class, "KeywordSearchConfigurationPanel2.showSnippetsCB.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -145,11 +149,12 @@ public class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel impleme
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(skipNSRLCheckBox)
.addComponent(showSnippetsCB)
.addComponent(filesIndexedLabel)
.addGroup(layout.createSequentialGroup()
.addGap(141, 141, 141)
.addComponent(filesIndexedValue, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(skipNSRLCheckBox)
.addComponent(frequencyLabel)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
@ -173,7 +178,9 @@ public class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel impleme
.addComponent(settingsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(skipNSRLCheckBox)
.addGap(13, 13, 13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(showSnippetsCB)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(frequencyLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(timeRadioButton1)
@ -195,7 +202,7 @@ public class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel impleme
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(chunksLabel)
.addComponent(chunksValLabel))
.addContainerGap(30, Short.MAX_VALUE))
.addContainerGap(116, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@ -209,6 +216,7 @@ public class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel impleme
private javax.swing.JSeparator informationSeparator;
private javax.swing.JLabel settingsLabel;
private javax.swing.JSeparator settingsSeparator;
private javax.swing.JCheckBox showSnippetsCB;
private javax.swing.JCheckBox skipNSRLCheckBox;
private javax.swing.ButtonGroup timeGroup;
private javax.swing.JRadioButton timeRadioButton1;
@ -221,6 +229,7 @@ public class KeywordSearchConfigurationPanel2 extends javax.swing.JPanel impleme
public void store() {
KeywordSearchSettings.setSkipKnown(skipNSRLCheckBox.isSelected());
KeywordSearchSettings.setUpdateFrequency(getSelectedTimeValue());
KeywordSearchSettings.setShowSnippets(showSnippetsCB.isSelected());
}
@Override

View File

@ -38,6 +38,8 @@ public class KeywordSearchSettings {
static final String PROPERTIES_OPTIONS = MODULE_NAME+"_Options";
static final String PROPERTIES_NSRL = MODULE_NAME+"_NSRL";
static final String PROPERTIES_SCRIPTS = MODULE_NAME+"_Scripts";
static final String SHOW_SNIPPETS = "showSnippets";
static final boolean DEFAULT_SHOW_SNIPPETS = false;
private static boolean skipKnown = true;
private static final Logger logger = Logger.getLogger(KeywordSearchSettings.class.getName());
private static UpdateFrequency UpdateFreq = UpdateFrequency.DEFAULT;
@ -124,6 +126,18 @@ public class KeywordSearchSettings {
ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, key, val);
}
static void setShowSnippets(boolean showSnippets) {
ModuleSettings.setConfigSetting(PROPERTIES_OPTIONS, SHOW_SNIPPETS, (showSnippets ? "true" : "false"));
}
static boolean getShowSnippets() {
if (ModuleSettings.settingExists(PROPERTIES_OPTIONS, SHOW_SNIPPETS)) {
return ModuleSettings.getConfigSetting(PROPERTIES_OPTIONS, SHOW_SNIPPETS).equals("true");
} else {
return DEFAULT_SHOW_SNIPPETS;
}
}
/**
* gets the currently set scripts to use
*

View File

@ -133,7 +133,8 @@ public class LuceneQuery implements KeywordSearchQuery {
public Map<String, List<ContentHit>> performQuery() throws NoOpenCoreException {
Map<String, List<ContentHit>> results = new HashMap<String, List<ContentHit>>();
//in case of single term literal query there is only 1 term
results.put(keywordString, performLuceneQuery(true));
boolean showSnippets = KeywordSearchSettings.getShowSnippets();
results.put(keywordString, performLuceneQuery(showSnippets));
return results;
}