Question: I am trying to add time constraints to my search method which means searching by date. I know lucene can only handle strings, but I am converting the dates to string first. But it's still not working and due to the complexity of the code base I'm not quite sure why it's not working. Here's a simple version:

```
@Indexed
public class SomeDocument extends Document{
}

public abstract class Document extends BaseEntity{
}

@Indexed
public class BaseEntity {

@IndexedEmbedded
private Date lastUpdatedDate;
}

//snippet of search method
BooleanQuery bq = new BooleanQuery();    
long oneDay = 1000L * 60 * 60 * 24;
long currentTime = System.currentTimeMillis();
Date dateOne = new Date(currentTime);
Date dateTwo = new Date(currentTime - (oneDay * 7)); // 1 week ago ago    
TermRangeQuery dateQuery = new TermRangeQuery("lastUpdatedDate", dateTwo.toString(),    dateOne.toString(), true, true);
bq.add(new BooleanClause(dateQuery, BooleanClause.Occur.MUST));

//more is added to boolean query, I create a full text query, and use the list() method

```

Does anyone see a place that is implemented incorrectly? Thank you!

Answer: 
You can call a function in the parent window when you click on a link in the frame.

In the parent html you need to add a function to handle the call. Something like

```
function iframeLinkClicked(url) {
     //do stuff
}

```

Then in the child window add a function to handle the click event of a hyperlink.

```
function linkClicked(hyperLink) {
    parent.iframeLinkClicked(hyperLink.href);
}

```

You need to add this to all hyperlinks

```
<a href="http://www.google.com" onclick="linkClicked(this);">google</a>

```

Now, when you click on a link, it will alert the parent window.

**Edit**: alternative to adding "onclick" to every hyperlink. 

You can add the event to the frame elements when the frame is loaded, if the frame html is in the same domain.

This is the complete script in the parent page.

```
<script type="text/javascript">

    function iframeLinkClicked(url) {
        alert(url);
    }
    function Load(iframe) {
        iframe.onload = null;
        try {
            var a = document.frames['iframe_Id'].document.getElementsByTagName('a');
            for (var i = 0; i < a.length; i++) {
                a[i].onclick = function () {
                    parent.iframeLinkClicked(this.href);
                    return false;
                };
            }
        } catch (e) {

        }

    }
</script>

```

This will replace your current `Load()` function. So the iframe still needs to have the load property set.

There is nothing to add to the child pages anymore. It's all done here.

```
<iframe id="iframe_Id" src="sample.html" 
style="background-color:white; height:100%; width:100%;" onload="Load(this);" ></iframe>

```
have a look at this:

```
var a = document.frames['iframe_Id'].document.getElementsByTagName('a');

for(i=0; i<a.length; i++) { 
  a[i].onclick = function() { 
    document.getElementById("iframe_Id").src = this.href;
    // and so on whatever you want to do
  }
}

```