fixed query, only collect words if reaching end of search