I have a bilingual dictionary database of 60000 pairs stored in GAE that's look like this:
date, tag, value
date, vis, screw
date, vis, screws
date, vis à bois, wood screw
date, vis à bout pointu, cone point screw
date, vis à braser, braze screw
date, vis à métaux, machine screw
.
Today with the following python script:
def get_value(self, tag):
entry = db.GqlQuery("SELECT * FROM StoredData where tag = :1", tag).get()
value = entry.value
value = unicode(value)
value = value.encode('ascii','xmlcharrefreplace')
if I ask for "vis" I only get "screw" in response.
Questions:
I would like to get also "screws" as a second answer, that is to say retrieve all entities having the same tag.
I would like to get also all entities containing the substring "screw" (with a minimum of 3 characters typed by user) :
screw, screws, wood screw, cone point screw, braze screw, machine screw
=> what GQL queries have I to make to show them in a table generated by this script ?
### Show the tags and values as a table.
###def show_stored_data(self):
### self.response.out.write('''
### <p><table border=1>
### <tr>
### <th>Key</th>
### <th>Value</th>
### <th>Created (GMT)</th>
### </tr>''')
### entries = db.GqlQuery(" ***GQL query n°1 or n°2*** ")
### for e in entries:
### entry_key_string = str(e.key())
### self.response.out.write('<tr>')
### self.response.out.write('<td>%s</td>' % e.tag)
### self.response.out.write('<td>%s</td>' % e.value)
### self.response.out.write('<td><font size="-1">%s</font></td>\n' % e.date.ctime())
### self.response.out.write('''
### <td><form action="/deleteentry" method="post"
### enctype=application/x-www-form-urlencoded>
### <input type="hidden" name="entry_key_string" value="%s">
### <input type="hidden" name="tag" value="%s">
### <input type="hidden" name="fmt" value="html">
### <input type="submit" style="background-color: red" value="Delete"></form></td>\n''' %
### (entry_key_string, e.tag))
### self.response.out.write('</tr>')
### self.response.out.write('</table>')
Many thanks in advance for your help.
Philippe