Forums: 【移行しました】サポート (Thread #37734)

metaタグから更新時刻を取得する際の問題について (2016-05-20 09:58 by enkimi #78073)

2015/1/28に「動的に生成されるページの更新日時の取得方法」について質問させてもらったものです。fessは9.3.1を使用しています。

その後、s2robot_transformer.diconに以下を記述するとhtmlページ内の<meta http-equiv="Last-Modified" content="2016-05-20T12:34:56+09:00">というmetaタグに記述された更新時刻を取得できることがわかったのですが、以下2点について悩んでいますので教えてください。

s2robot_transformer.diconに追加した記述
<initMethod name="addFieldRule">
<arg>"lastModified"</arg>
<arg>"//META[@http-equiv='Last-Modified']/@content"</arg>
</initMethod>

以下、質問です。

1. metaタグ内の更新時刻のタイムゾーンが取得できないのですが、タイムゾーンはどのように記述すればよいでしょうか。上記の例ですとGMTの12:34:56と取得されてしまい、検索結果のページには更新時刻がそれに対応したJSTの時刻の21:34:56と表示されます。タイムゾーンの記述を+09:00, +0900, JST等としてみたのですが結果は同じでした。

2. 上記metaタグのあるページの更新時刻は取得できるのですが、上記のmetaタグがないページがあるとクローラがエラーで止まってしまいます。 具体的には「ジョブログ」を見るとステータスは「FAIL」で、「結果」には
ExitCode: 1
Output:
No database files have been found in directory ...
と表示されます。
またsolr.logには以下のメッセージが表示されています。
 ERROR org.apache.solr.core.SolrCore - org.apache.solr.common.SolrException: Invalid Date in Date Math String:'null 2016-05-20T00:49:35.000Z'
(以下省略)
このような状態になるとwebapps/fess/WEB-INF/conf以下の*.propertiesファイルをすべて削除しないとクローラーが正常に起動できなくなります。metaタグがないページは通常通りlast-modifiedから更新時刻を取得し、正常にクロールが継続するようにすることはできますでしょうか。

以上、よろしくお願いいたします。

Reply to #78073×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: metaタグから更新時刻を取得する際の問題について (2016-06-01 06:23 by shinsuke #78135)

jp/sf/fess/transformer/FessXpathTransformer.java あたりを
カスタマイズする必要があると思います。
Reply to #78073

Reply to #78135×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: metaタグから更新時刻を取得する際の問題について (2016-06-10 13:44 by enkimi #78177)

[メッセージ #78135 への返信]
> jp/sf/fess/transformer/FessXpathTransformer.java あたりを
> カスタマイズする必要があると思います。

遅くなりましたが、回答ありがとうございました。
こちらでも調べてわかったことをお知らせします。

1. ソースコードを見たところタイムゾーンを見ていないようでした。ですのでタイムゾーンを反映させるようにするにはコードを修正する必要がありそうです。

2. metaタグが見つからないと"null"という文字が返され、それを日時取得のパースをしようとしてエラーとなっていました。以下のようにmetaタグが見つからなかった場合は"null"ではなく空文字を返すようにしたらエラーが出なくなりました。

<initMethod name="addFieldRule">
<arg>"lastModified"</arg>
<arg>"string(//META[@http-equiv='Last-Modified']/@content)"</arg>
</initMethod>

Reply to #78135

Reply to #78177×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login