Implement advanced search

This commit is contained in:
Kovid Goyal 2008-01-20 22:57:45 +00:00
parent 1de21832e5
commit 2080d9e52d
2 changed files with 12 additions and 0 deletions

View File

@ -42,6 +42,8 @@ class SearchItem(Ui_Form, QWidget):
def token(self): def token(self):
txt = qstring_to_unicode(self.text.text()).strip() txt = qstring_to_unicode(self.text.text()).strip()
if txt: if txt:
if self.negate.isChecked():
txt = '!'+txt
tok = self.FIELDS[qstring_to_unicode(self.field.currentText())]+txt tok = self.FIELDS[qstring_to_unicode(self.field.currentText())]+txt
if re.search(r'\s', tok): if re.search(r'\s', tok):
tok = '"%s"'%tok tok = '"%s"'%tok

View File

@ -30,6 +30,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="negate" >
<property name="toolTip" >
<string>&lt;p>Negate this match. That is, only return results that &lt;b>do not&lt;/b> match this query.</string>
</property>
<property name="text" >
<string>Negate</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>