mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
fed26f33a8
to support the new time parser and search functions in YaCy a high precision detection of date and time on the day is necessary. That requires that the time zone of the document content and the time zone of the user, doing a search, is detected. The time zone of the search request is done automatically using the browsers time zone offset which is delivered to the search request automatically and invisible to the user. The time zone for the content of web pages cannot be detected automatically and must be an attribute of crawl starts. The advanced crawl start now provides an input field to set the time zone in minutes as an offset number. All parsers must get a time zone offset passed, so this required the change of the parser java api. A lot of other changes had been made which corrects the wrong handling of dates in YaCy which was to add a correction based on the time zone of the server. Now no correction is added and all dates in YaCy are UTC/GMT time zone, a normalized time zone for all peers.
79 lines
2.4 KiB
Java
79 lines
2.4 KiB
Java
/**
|
|
* rssParser.java
|
|
* Copyright 2010 by Michael Peter Christen, mc@yacy.net, Frankfurt am Main, Germany
|
|
* First released 20.08.2010 at http://yacy.net
|
|
*
|
|
* $LastChangedDate: 2011-04-21 15:58:49 +0200 (Do, 21 Apr 2011) $
|
|
* $LastChangedRevision: 7672 $
|
|
* $LastChangedBy: orbiter $
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program in the file lgpl21.txt
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
|
|
package net.yacy.document.parser;
|
|
|
|
import java.io.InputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
import net.yacy.cora.document.id.AnchorURL;
|
|
import net.yacy.document.AbstractParser;
|
|
import net.yacy.document.Document;
|
|
import net.yacy.document.Parser;
|
|
import net.yacy.document.VocabularyScraper;
|
|
|
|
public class rdfParser extends AbstractParser implements Parser {
|
|
|
|
public rdfParser() {
|
|
super("RDF Parser");
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("rdf");
|
|
this.SUPPORTED_MIME_TYPES.add("application/rdf+xml");
|
|
}
|
|
|
|
@Override
|
|
public Document[] parse(
|
|
final AnchorURL location,
|
|
final String mimeType,
|
|
final String charset,
|
|
final VocabularyScraper scraper,
|
|
final int timezoneOffset,
|
|
final InputStream source)
|
|
throws Failure, InterruptedException {
|
|
|
|
|
|
// this function currently only registers detected rdf files.
|
|
|
|
// next step: load rdf content into triplestore.
|
|
|
|
final List<Document> docs = new ArrayList<Document>();
|
|
|
|
Document doc;
|
|
|
|
String all = "rdfdatasource";
|
|
doc = new Document(location, mimeType, charset, null, null, null, singleList(""), "",
|
|
"", null, new ArrayList<String>(0), 0, 0, all, null, null, null, false, new Date());
|
|
|
|
docs.add(doc);
|
|
|
|
final Document[] da = new Document[docs.size()];
|
|
docs.toArray(da);
|
|
return da;
|
|
}
|
|
|
|
}
|